作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

XIAOPAN

... ... @@ -13,6 +13,7 @@ use app\portal\model\EquipmentModel;
use app\portal\model\OrderModel;
use cmf\controller\AdminBaseController;
use EasyWeChat\Payment\Order;
use think\Db;
/**
* Class AdminOrderController
... ... @@ -63,4 +64,13 @@ class AdminOrderController extends AdminBaseController{
$this->assign('end_number', isset($param['end_number']) ? $param['end_number'] : '');
return $this->fetch();
}
//更改订单状态
public function endOrder(){
$param=$this->request->param();
Db::name('order')
->where('id',$param['id'])
->update(['state'=>3]);
$this->success('完成订单成功');
}
}
\ No newline at end of file
... ...
... ... @@ -218,9 +218,7 @@ class UsersController extends HomeBaseController{
* @author 董瑞恩
* @url /portal/users/getOrderById1
* @method GET
*
* @param name:users_id type:String require:1 default:无 other: desc:用户id
*
* @return order_no:订单号
* @return users_id:用户id
* @return start_time:开始使用时间
... ... @@ -233,7 +231,12 @@ class UsersController extends HomeBaseController{
public function getOrderById1(){
$users_id=$this->request->param('users_id');
$order= Db::name('order')->field('order_no,users_id,start_time')->where(['users_id'=>$users_id,'state'=>1,'type'=>1])->find();
$order= Db::name('order')
->alias('o')
->join('equipment e','o.eq_name=e.name')
->field('o.order_no,o.users_id,o.start_time,e.serial_number')
->where(['o.users_id'=>$users_id,'o.state'=>1,'o.type'=>1,'e.is_delete'=>0])
->find();
if (empty($order)){
$this->apiResponse(200,'没有未完成订单');
}
... ... @@ -270,7 +273,12 @@ class UsersController extends HomeBaseController{
public function getOrderById2(){
$users_id=$this->request->param('users_id');
$order= Db::name('order')->where(['users_id'=>$users_id,'state'=>2,'type'=>'1'])->find();
$order= Db::name('order')
->alias('o')
->join('equipment e','o.eq_name=e.name')
->where(['o.users_id'=>$users_id,'o.state'=>2,'o.type'=>'1','e.is_delete'=>0])
->field('o.*,e.serial_number')
->find();
if (empty($order)){
$this->apiResponse(200,'没有未支付订单');
}
... ...
... ... @@ -36,6 +36,7 @@
<th>使用时长</th>
<th>使用费用</th>
<th>支付状态</th>
<th>操作</th>
</tr>
</thead>
<foreach name="data" item="vo">
... ... @@ -52,6 +53,10 @@
<else />
已支付
</eq></td>
<td><eq name="vo.state" value="2">
<a href="{:url('AdminOrder/endOrder',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn">完成订单</a>
</eq>
</td>
</tr>
</foreach>
</table>
... ...