1234567891011121314151617181920212223242526272829 |
- <?php
- namespace app\cxinv\controller;
- use app\cxinv\model\CgdInfo;
- use think\App;
- class Purchease extends Base{
- public function __construct(App $app) {
- parent::__construct($app);
- $this->model=new CgdInfo();
- }
- public function status(){
- $param= $this->request->param(['id'=>'','status'=>''],'post','trim');
- $valid= $this->validate($param,[
- 'id|订单编号'=>'require|number',
- 'status|订单状态'=>'require|number|in:0,1,2,3'
- ]);
- if($valid!==true) return error($valid);
- $model= $this->model->findOrEmpty($param['id']);
- if($model->isEmpty())return error('订单不存在');
- if($model->status==$param['status']) return error('订单状态已更新');
- $model->status=$param['status'];
- $save = $model->save();
- if($save===false)return error('更新失败');
- return success('更新成功');
- }
- }
|