123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class User extends Base
- {
- public function info(){
- $info = model('User')->info($this->userId,$this->orgId);
- if($info){
- $orgName = Db::name('org')
- ->where('id',$this->orgId)
- ->value('name');
- $info['orgName'] = $orgName;
- $info['h5pre'] = config('app.addr_url');
- HelpHander::success($info);
- }else{
- HelpHander::error(model('User')->getError());
- }
- }
- public function exusers(){
- $id = input('id/d',0);
- $work = input('work/d',1);
- if(!in_array($work,[-1,0,1])){
- HelpHander::error('参数错误');
- }
- $users = model('WorkTypeMode')->getRolesUserApp($id,$this->orgId,$work);
- HelpHander::success($users);
- }
- //品控执行人列表
- public function qualityUserList(){
- $users = model('WorkTypeMode')->getRolesUser(18,$this->orgId,1);
- $list = [];
- foreach ($users as $k=>$v){
- foreach ($v['user'] as $v1){
- $list[] = $v1;
- }
- }
- HelpHander::success($list);
- }
- //品控知会人列表
- public function qualityIformUserList(){
- $id = input('id/d',0);
- $users = model('WorkTypeMode')->commonRolesUserList($id,$this->orgId);
- HelpHander::success($users);
- }
- //公共角色列表
- public function commonRoles(){
- $commons = model('Roles')->getCommonList(1);
- $a = [];
- foreach ($commons as $k=>$v){
- $a[] = [
- 'id'=>$v['id'],
- 'title'=>$v['name'],
- ];
- }
- HelpHander::success($a);
- }
- //获取二级调度角色
- public function getTwoDispatchRoles(){
- $type = input('id/d',1);
- $list = model('user')->get_two_dispatch_role1($this->orgId,$type);
- HelpHander::success($list);
- }
- //判断工人是否可以自发
- public function isSpontaneous(){
- $workType = input('WorkTypeMode/d',1);
- $roles = input('rolesId/d',0);
- if(!in_array($workType,[0,1,2,3,4])){
- HelpHander::error('订单类型错误');
- }
- $rolesInfo = Db::name('roles')
- ->where('id',$roles)
- ->find();
- if($rolesInfo['parent_id'] >0){
- $roles = $rolesInfo['parent_id'];
- }
- $map[] = ['','exp',Db::raw("FIND_IN_SET(".$roles.",roles)")];
- $info = Db::name('work_type_mode')
- ->where($map)
- ->column('id');
- if(empty($info)){
- $off = 0;
- }else{
- if(!in_array($workType,$info)){
- $off = 0;
- }else{
- $off = 1;
- }
- }
- HelpHander::success($off);
- }
- public function updateHeadImage(){
- $headimage = input('imageUrl','','trim');
- $ret=Db::name('user')
- ->where('id',$this->userId)
- ->update(['head_image'=>$headimage]);
- if($ret){
- HelpHander::success(null,'修改成功');
- }else{
- HelpHander::error('修改失败');
- }
- }
- }
|