<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                >[info] >## TrainerspicController ```` <?php /** * Created by PhpStorm. * User: Administrator * Date: 2018/9/8 * Time: 15:12 */ namespace app\adminapi\controller\trainers; use app\admin\model\Nintyuser; use app\admin\model\ParklinesmsInfo; use app\admin\model\Trainer; use app\admin\model\Trainerpic; use app\adminapi\controller\AdminApi; use app\adminapi\exception\ParameterException; use IanZhi\Parkline\Exception\ParklineException; use IanZhi\Parkline\ParklineApi; use think\Request; class TrainerspicController extends AdminApi { public function __construct() { parent::__construct(); } /** * 搜索-獲取指定條件的信息 * @param Request $request * @return string * @throws \think\exception\DbException */ public function index(Request $request) { //獲取參數 $params = $request->param(); //篩選私教 $trainer_id = @$params['trainer_id']; //篩選圖片類型 $pic_type = @$params['pic_type']; //搜索條件 $condition = ' 1=1 '; if($trainer_id != '') $condition .= " AND trainer_id =".$trainer_id; if($pic_type != '') $condition .= " AND pic_type =".$pic_type; //查詢數據 if(empty($params['list_rows'])){ $params['list_rows'] = 10; } if(@$params['isdel'] == ''){ //未刪除 $isdel = 0; }else{ $isdel = $params['isdel']; } $result = Trainerpic::where($condition)->where('isdel',$isdel)->order('pic_order desc')->paginate($params['list_rows']); $page = $result->render(); $this->success($result,$page); } /** * @param Request $request * @throws ParameterException * @throws \think\exception\DbException */ public function add(Request $request) { //獲取參數 $params = $request->param(); //判斷是否上傳了圖片 if(empty($params['pic_image'])){ throw new ParameterException('圖片不能為空'); } //查看之前是否已存在刷臉照片 if($params['pic_type'] == 1){ $data_status = Trainerpic::where('trainer_id',$params['trainer_id'])->where('pic_type',1)->delete(); } $result = Trainerpic::createData($params); if($result){ if($params['pic_type'] == 1){ //刷臉設備更新 TODO 需要更新刷臉設備圖片 //通過當前教練id,獲取手機號 $user_info = Trainer::where('id',$params['trainer_id'])->find(); //手機號 // $mobile_user = $user_info['mobile']; //微信昵稱 // $name_user = base64_decode($user_info['name']); //用戶名稱real_name // $real_name = $user_info['real_name']; //獲取用戶名 // $name_name = empty($real_name)?$name_user:$real_name; if(empty($user_info['mobile'])){ $this->success('當前手機號為空,查找指定手機號失敗'); } //1:查找指定成員mobile // $status_park = ParklineApi::queryUser($mobile_user); // if($status_park['code'] == '100101'){ // //查詢當前健身房旗下所有devid // $parklines_all = ParklinesmsInfo::where('fitness_id',1)->select(); // foreach ($parklines_all as $value){ // //獲取設備 // $deviceId = $value['devid']; // $status_face = ParklineApi::setUserFace($user_info['mobile'],$deviceId,$params['pic_image']); // $test[] = $status_face; // } // $this->success($test); // } //2:為空時:TODO 為空時 } $this->success($result); }else{ throw new ParameterException('參數錯誤'); } } /** * @param Request $request * @return void * @throws ParameterException * @throws ParklineException * @throws \think\exception\DbException */ public function update(Request $request) { //獲取參數 $pic_id = $request->param('id'); $pic_type = $request->param('pic_type'); $pic_image = $request->param('pic_image'); $trainer_id = $request->param('trainer_id'); // 參數驗證 if (!$pic_id || !$trainer_id) { throw new ParameterException('缺少參數!'); } $pic = Trainerpic::get($pic_id); if (!$pic) { throw new ParameterException('id對應的圖片不存在'); } $pic->pic_type = $pic_type; $pic->pic_image = $pic_image; // $pic->pic_image = 'https://199fit.com/uploads/20180927/78c7e6d304ace7ada372607178f2fe46.jpg'; $pic->save(); if ($pic->pic_type == 1) { //判斷健身房下是否有設備 $locks = $pic->getFitnessLocks(); if(empty($locks)){ throw new ParklineException('當前健身房下暫無設備!'); } // 判斷用戶是否創建 // $equipment_bind_info = ParklineApi::queryUser($pic->trainer->mobile); // if($equipment_bind_info['code'] != '100101'){ // $this->addParklineUser(); // } // 判斷用戶是否綁定 $mobile = $pic->trainer->mobile; $result = ParklineApi::queryUserBinds($mobile, 0, 1000); if ($result['code'] != '100101') { throw new ParklineException('獲取用戶綁定信息失敗!'); } $binds = $result['data']; // foreach ($binds as $bind) { // $add_bind_flag = true; // foreach ($locks as $lock) { // if ($bind['devid'] == $lock['devid']) { // $add_bind_flag = false; // } // } // if ($add_bind_flag) { // ParklineApi::bindUserToEquipment( // $pic->trainer->mobile, // $bind['devid'], // '01', // date('Y-m-d', time()), // date('Y-m-d', time() + 365 * 24 * 3600), // '00:00', // '23:59'); // } // } // $file_size = fileSize('.'.$pic->pic_image); // var_dump($file_size);exit; // $file1=file_get_contents($info->getPathname()); // return strlen($file1); // if(strlen($file1)>999999) // 更改用戶刷臉信息 foreach ($binds as $bind) { $face_file = fileToBase64('.'.$pic->pic_image); $update_picstatus[] = ParklineApi::setUserFace($pic->trainer->mobile,$bind['devid'],$face_file); } } $this->success($update_picstatus); // $this->success($pic); } /** * @param Request $request * @throws ParameterException * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ public function del(Request $request) { //獲取參數 $params = $request->param(); //循環 刪除 foreach ($params['ids'] as $v){ //校驗數據 $status_id = Trainerpic::get($v); if( empty($status_id) ){ throw new ParameterException('該參數不存在:id'); } //軟刪除數據 isdel是否刪除:0=否,1=是 $result = Trainerpic::where('id',$v)->update(['isdel'=>1]); } $this->success($result); } }
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看