Browse Source

女性任务,得金币数量不一样

lizhen_gitee 11 months ago
parent
commit
7da9476be7

+ 1 - 0
application/admin/lang/zh-cn/task.php

@@ -14,6 +14,7 @@ return [
     'Url_type 2'  => '提示',
     'Number'      => '要求完成个数',
     'Exp'         => '增加金币数量',
+    'Exp_woman'   => '增加金币数量(女性)',
     'Is_show'     => '是否上架',
     'Is_show 1'   => '是',
     'Is_show 0'   => '否',

+ 6 - 0
application/admin/view/task/add.html

@@ -69,6 +69,12 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Exp_woman')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-exp_woman" data-rule="required" class="form-control" name="row[exp_woman]" type="number" value="0">
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Is_show')}:</label>
         <div class="col-xs-12 col-sm-8">
                         

+ 6 - 0
application/admin/view/task/edit.html

@@ -69,6 +69,12 @@
         </div>
     </div>
     <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Exp_woman')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-exp_woman" data-rule="required" class="form-control" name="row[exp_woman]" type="number" value="{$row.exp_woman|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Is_show')}:</label>
         <div class="col-xs-12 col-sm-8">
                         

+ 16 - 3
application/api/controller/Task.php

@@ -38,10 +38,16 @@ class Task extends Api
             $where["is_show"] = 1;
 
             $taskList = Db::name('task')
-                ->field("id,type_id,image,name,exp,number,".$jump_url." as jump_url,url_type")
+                ->field("id,type_id,image,name,exp,exp_woman,number,".$jump_url." as jump_url,url_type")
                 ->where($where)
                 ->autopage()
                 ->select();
+            foreach($taskList as $key => &$val){
+                if($this->auth->gender == 0){
+                    $val['exp'] = $val['exp_woman'];
+                }
+                unset($val['exp_woman']);
+            }
             $taskList = list_domain_image($taskList,['image']);
 
             $today = strtotime(date("Y-m-d 00:00:00"));
@@ -83,12 +89,18 @@ class Task extends Api
             $where["a.type_id"] = 1;
             $where["a.is_show"] = 1;
             $taskList = Db::name('task')->alias("a")
-                ->field("a.id,a.type_id,a.image,a.name,a.exp,a.number,a.".$jump_url." as jump_url,a.url_type,l.pace,l.is_reward,l.is_finish,l.finish_number")
+                ->field("a.id,a.type_id,a.image,a.name,a.exp,a.exp_woman,a.number,a.".$jump_url." as jump_url,a.url_type,l.pace,l.is_reward,l.is_finish,l.finish_number")
                 ->join("task_log l", "l.task_id = a.id and l.user_id = ".$this->auth->id, "left")
                 ->where($where)
                 ->autopage()
                 ->order("a.id","asc")
                 ->select();
+            foreach($taskList as $key => &$val){
+                if($this->auth->gender == 0){
+                    $val['exp'] = $val['exp_woman'];
+                }
+                unset($val['exp_woman']);
+            }
             $taskList = list_domain_image($taskList,['image']);
 
 
@@ -140,7 +152,8 @@ class Task extends Api
         Db::startTrans();
         try{
             // 增加用户金币
-            $res1 = model('wallet')->lockChangeAccountRemain($this->auth->id,'jewel',$taskInfo["exp"],32,$taskInfo['name'],'task_log',$tasklogInfo['id']);
+            $exp = $this->auth->gender == 0 ? $taskInfo['exp_woman'] : $taskInfo['exp'];
+            $res1 = model('wallet')->lockChangeAccountRemain($this->auth->id,'jewel',$exp,32,$taskInfo['name'],'task_log',$tasklogInfo['id']);
             if($res1['status'] === false){
                 Db::rollback();
                 $this->error($res1['msg']);

+ 1 - 0
public/assets/js/backend/task.js

@@ -34,6 +34,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 //                        {field: 'url_type', title: __('Url_type'), searchList: {"1":__('Url_type 1'),"2":__('Url_type 2')}, formatter: Table.api.formatter.normal},
 //                        {field: 'number', title: __('Number')},
                         {field: 'exp', title: __('Exp')},
+                        {field: 'exp_woman', title: __('Exp_woman')},
                         {field: 'is_show', title: __('Is_show'), searchList: {"1":__('Is_show 1'),"0":__('Is_show 0')}, formatter: Table.api.formatter.normal},
                         {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},