public function method_name(Request $request) { $attribute1 = $request->post('attribute1', 0); $attribute2 = $request->post('attribute2', ''); if(!empty($attribute1)){ $attribute = ShopLib::wxAppLogin($attribute1); if(!$attribute) { $errData = [ 'errcode' => -2, 'msg' => 'error message' ]; return json($errData); } }
$Model = $this->getModel(); $where['key'] = [ 'key_name' => $value, ]; if(!empty($attribute)){ $where['key'] = [ 'key_name' => $attribute['key_name'], ]; } } $Result = $Model::getDetail($where['key'], NULL);
$result = [ 'errcode' => 0, 'data' => $Result ]; return json_encode($result); }
|