作者 王小刚

数据库

... ... @@ -93,7 +93,7 @@ class OrderSalesmanController extends WeChatBaseController
public function getOrderSalesman(){
$param = $this->request->param();
if(!empty($param['school'])){
$where['school'] = ['eq',$param['school']];
$where['school'] = ['like',"%$param[school]%"];
}
if(!empty($param['grade'])){
$param['grade'] = explode(' - ',$param['grade']);
... ... @@ -290,4 +290,37 @@ class OrderSalesmanController extends WeChatBaseController
return false;
}
}
public function updatePost(){
$param = $this->request->param();
$indent_id = $this->request->param('indent_id',0,'intval');
if(empty($indent_id)){
$this->error('缺少必要参数123');
}
$indentModel = new IndentModel();
$data = $indentModel->findData(['id'=>$indent_id]);
if($data['is_courier'] == 1){
if(empty($param['name']) || empty($param['region']) || empty($param['school']) || empty($param['grade_class']) || empty($param['phone'])){
$this->error('缺少必要参数');
}
$grade_class = explode('-',$param['grade_class']);
$arr['name'] = $param['name'];
$arr['phone'] = $param['phone'];
$arr['region'] = $param['region'];
$arr['school'] = preg_replace('# #','',$param['school']);
$arr['grade'] = $grade_class[0];
$arr['class'] = $grade_class[1];
$result = $indentModel ->updateData(['id'=>$indent_id],$arr);
}else if($data['is_courier'] == 2){
if(empty($param['name']) || empty($param['phone']) || empty($param['region']) || empty($param['region_detail'])){
$this->error('缺少必要参数123');
}
$arr['name'] = $param['name'];
$arr['phone'] = $param['phone'];
$arr['region'] = $param['region'];
$arr['region_detail'] = $param['region_detail'];
$result = $indentModel ->updateData(['id'=>$indent_id],$arr);
}
$this->success('SUCCESS');
}
}
\ No newline at end of file
... ...
... ... @@ -204,7 +204,7 @@ class WeChatBaseController extends BaseController
*/
public function checkWeChatUserLogin()
{
// $user = Db::name('user')->where('id',3)->find();
// $user = Db::name('user')->where('id',6)->find();
// cmf_update_current_user($user);
// session('user',null);
$userId = cmf_get_current_user_id();
... ...