Commit c6eef749 by 朱继来

调整采购接口

parent 5061ce52
Showing with 21 additions and 3 deletions
......@@ -7,6 +7,7 @@ use Request;
use DB;
use App\Model\CmsModel;
use App\Model\Mongo\SpuModel;
use App\Http\Controllers\PermController;
//公共模型
class CommonModel extends Model
......@@ -86,10 +87,27 @@ class CommonModel extends Model
/*
* 查询采购名称
*/
public function UserList($k,$types = 1){
public function UserList($k,$types = 1)
{
$dbcms = DB::connection();
if ($types == 1) { #模糊搜索
$purInfo = $dbcms->select("select userId as value,name as name from user_info where name like '%".$k."%' limit 10");
if ($types == 1) { #模糊搜索
$perm = new PermController;
$perm->getSubDepartmentId(8, $department_ids); // 获取采购所有部门
$CmsModel = new CmsModel;
$purInfo = $CmsModel->where('status', 0)
->whereIn('department_id', $department_ids)
->where(function($query) use ($k) {
if ($k) {
$query->where('name', 'like', '%'.$k.'%');
}
})
->select('userId as value', 'name')
->get()
->toArray();
// $purInfo = $dbcms->select("select userId as value,name as name from user_info where department_id in (".json_encode($department_ids).") and status = 0 and name like '%".$k."%'");
echo json_encode($purInfo,JSON_UNESCAPED_UNICODE) ;
exit();
}else{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment