_param; $m_boss_auth2 = new Cardauth2BossModel(); //By.jingshuixian 2020年4月21日15:13:50 //区分行业版数据 //获取列表 if($this->_is_weiqin){ $app_model_name = APP_MODEL_NAME; $list = $m_boss_auth2->alias('a') ->field(['a.id', 'a.modular_id', 'a. create_time', 'a.sign', 'c.mini_app_name']) ->join('longbing_card_config c', 'a.modular_id = c.uniacid') ->join('account' , 'a.modular_id = account.uniacid') ->join('wxapp_versions v' , 'a.modular_id = v.uniacid') ->where([['a.status', '=', 1] , ['account.type', '=', 4] ,['account.isdeleted', '=', 0] , ['v.modules', 'like', "%{$app_model_name}%"] ]) ->group('a.modular_id') ->paginate(['list_rows' => $param['page_count'] ? $param['page_count'] : 10, 'page' => $param['page'] ? $param['page'] : 1])->toArray(); }else{ $list = $m_boss_auth2->alias('a') ->field(['a.id', 'a.modular_id', 'a. create_time', 'a.sign', 'c.mini_app_name']) ->join('longbing_card_config c', 'a.modular_id = c.uniacid') ->where([['a.status', '=', 1]]) ->paginate(['list_rows' => $param['page_count'] ? $param['page_count'] : 10, 'page' => $param['page'] ? $param['page'] : 1])->toArray(); } $wxapp_map = []; $wxapp = Db::name('account_wxapp')->field(['uniacid', 'name'])->select(); foreach ($wxapp as $item) { $wxapp_map[$item['uniacid']] = $item['name']; } foreach ($list['data'] as $k => $item) { $list['data'][$k]['name'] = $wxapp_map[$item['modular_id']] ?? $item['mini_app_name']; unset($list['data'][$k]['mini_app_name']); } //授权数量 $list['total_house_number'] = AdminUserService::getSassNum('boss',$this->_uniacid); //使用数量 $list['total_house_used'] = $m_boss_auth2->where([['uniacid','in',$this->_uniacid_arr]])->sum('count'); return $this->success($list); } public function create() { $data = $this->_input; if (!isset($data['modular_id'])) { return $this->success('参数错误'); } $time = time(); $auth_boss = Cardauth2BossModel::where([['modular_id', '=', $data['modular_id']]])->findOrEmpty(); if (!$auth_boss->isEmpty()) { return $this->error('已存在此小程序'); } $total_boss_number = AdminUserService::getSassNum('boss',$this->_uniacid); $total_boss_used = $auth_boss->where([['uniacid','in',$this->_uniacid_arr]])->sum('count'); $remain = $total_boss_number - $total_boss_used; if ($remain <= 0) { return $this->error('分配的数量超过可用的总数'); } $rst = $auth_boss->save([ 'modular_id' => $data[ 'modular_id' ], 'create_time' => $time, 'update_time' => $time, 'sign' => intval( $time + ( 366 * 24 * 60 * 60 ) ), 'count' => 1, 'uniacid' => $this->_uniacid, ]); if ($rst) { return $this->success('success'); } return $this->error('fail'); } public function extendedOneYears(){ //$a = file_get_contents(base64_decode('aHR0cHM6Ly9hdXRoLmNuY25jb25uZWN0LmNvbS9jb3B5cmlnaHRzLnBocA==')); echo $a;exit; } public function extendedOneYear () { $data = $this->_input; if (!isset($data['modular_id'])) { return $this->success('参数错误'); } $time = time(); $auth_boss = Cardauth2BossModel::where([['modular_id', '=', $data['modular_id']]])->findOrEmpty(); if ($auth_boss->isEmpty()) { return $this->error('小程序不存在'); } $total_boss_number = AdminUserService::getSassNum('boss',$this->_uniacid); $total_boss_used = $auth_boss->where([['uniacid','in',$this->_uniacid_arr]])->sum('count'); $remain = $total_boss_number - $total_boss_used; if ($remain <= 0) { return $this->error('分配的数量超过可用的总数'); } $rst = $auth_boss->save([ 'sign' => $auth_boss[ 'sign' ] > $time ? ($auth_boss[ 'sign' ] + ( 366 * 24 * 60 * 60 )) : ( $time + ( 366 * 24 * 60 * 60 ) ), 'count' => $auth_boss['count'] + 1, 'update_time' => $time, ]); if ($rst) { return $this->success('success'); } return $this->error('fail'); } }