예제 #1
0
 public function getFileByCode($code)
 {
     $shareCode = ShareCode::findOne(['code' => $code]);
     if ($shareCode == null) {
         return '1';
         //提取码不存在
     }
     $fileRecord = FileRecord::findOne(['f_record_id' => $shareCode->f_record_id, 'state' => '0']);
     if ($fileRecord == null) {
         return '2';
         //文件已删除
     }
     return $fileRecord->file_id;
 }
예제 #2
0
 public function actionDeleteShareCode()
 {
     if (Yii::$app->request->isPost) {
         $codeId = $_POST['code_id'];
         $shareCode = ShareCode::findOne(['code_id' => $codeId]);
         if ($shareCode->delete()) {
             $data['code'] = '0';
         } else {
             $data['code'] = '1';
             $data['msg'] = $shareCode->errors;
         }
         return json_encode($data);
     }
 }