gq 8 年之前
父節點
當前提交
e5f233d50d

+ 6 - 1
server/app/Http/Controllers/Api/V1/DreamController.php

xqd
@@ -270,7 +270,12 @@ class DreamController extends Controller
         $dream = DreamInfoModel::find($dream_id);
         $user_id = $dream->user_id;
         $coin = $request->coin;
-        $user_care_dream = UserCareDream::where('user_id',$user->id)->where('dream_id',$dream_id)->first();
+        if ($dream->get_coin == $dream->coin) {
+            return $this->error(ErrorCode::SUP_TOP);
+        } elseif($coin + $dream->get_coin > $dream->coin){
+            $coin = $coin + $dream->get_coin - $dream->coin ;
+        }
+        $user_care_dream = UserCareDream::where('user_id', $user->id)->where('dream_id', $dream_id)->first();
         $is_collection = empty($user_care_dream) ? 0 :1 ;
         $setting = BaseSettingsModel::where('category','score')->select('key','value')->first();
         $a = count($setting) > 0 ? $setting->key : '';

+ 2 - 0
server/app/Services/Base/ErrorCode.php

xqd
@@ -68,10 +68,12 @@ final class ErrorCode {
     const LOCK_USER = 1309;
 //    const MERCHANT_BALANCE_NOT_ENOUGH = 1311;
     const KEY_ERROR = 1310;
+    const SUP_TOP = 1410;
 
     //错误常量枚举
     private static $_msg = [
         self::DREAM_NOT_EXIST => '梦想不存在',
+        self::SUP_TOP => '支持已达上限',
         self::ATTACHMENT_DELETE_FAILED => '删除附件文件失败',
         self::ATTACHMENT_MOVE_FAILED => '移动附件失败',
         self::ATTACHMENT_RECORD_DELETE_FAILED => '删除附件记录失败',

+ 0 - 4
server/routes/api.php

xqd
@@ -141,10 +141,6 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'my.collection',
         'uses' => 'MyController@collection',
     ]);
-    $api->get('my/search_collection', [
-        'as' => 'my.search_collection',
-        'uses' => 'MyController@searchCollection',
-    ]);
     $api->get('my/setting', [
         'as' => 'my.setting',
         'uses' => 'MyController@setting',