Commit 6d31b36d by duwenjun

Merge branch 'dev/ver/1.1.0' into 'master'

调整采购接口

See merge request !3
parents 67713314 c6eef749
Showing with 20 additions and 2 deletions
...@@ -7,6 +7,7 @@ use Request; ...@@ -7,6 +7,7 @@ use Request;
use DB; use DB;
use App\Model\CmsModel; use App\Model\CmsModel;
use App\Model\Mongo\SpuModel; use App\Model\Mongo\SpuModel;
use App\Http\Controllers\PermController;
//公共模型 //公共模型
class CommonModel extends Model class CommonModel extends Model
...@@ -86,10 +87,27 @@ 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(); $dbcms = DB::connection();
if ($types == 1) { #模糊搜索 if ($types == 1) { #模糊搜索
$purInfo = $dbcms->select("select userId as value,name as name from user_info where name like '%".$k."%' limit 10"); $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) ; echo json_encode($purInfo,JSON_UNESCAPED_UNICODE) ;
exit(); exit();
}else{ }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