afa 10 月之前
父节点
当前提交
b6e3337ef7

+ 1 - 1
application/admin/view/general/announcement/edit.html

@@ -42,7 +42,7 @@
     <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Details')}:</label>
         <div class="col-xs-12 col-sm-8">
-            <textarea id="c-details" class="form-control editor" rows="5" name="row[details]" cols="50">{$row.details|htmlentities}</textarea>
+            <textarea id="c-body" class="form-control editor" rows="5" name="row[body]" cols="50">{$row.body|htmlentities}</textarea>
         </div>
     </div>
     <div class="form-group layer-footer">

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

@@ -3,6 +3,7 @@
 namespace app\api\controller;
 
 use think\Db;
+use think\db\Expression;
 use app\common\controller\Api;
 use app\common\model\ProductLists;
 use app\common\model\ProductsModel;
@@ -28,15 +29,27 @@ class Product extends Api
     {
         $list = $productsModel->where('status', 1)->column('id,'.$this->lan.'_title as title');
         $resp = array();
-        foreach ($list as $kk =>$val) {
-            $pro = $productLists->with('productpopular')->where('productpopular.status', '<', $productPopular::STOP)->where('product_lists.type_id', $kk)
-            ->order('productpopular.start_time', 'asc')->select();
+
+        foreach ($list as $kk =>$val) 
+        {
+            $pro= $productPopular->alias('a')
+                ->join("product_list b", "b.id=a.product_id", "LEFT")
+                ->field('a.id,'.'b.'.$this->lan.'_name as name,a.product_id,b.thum as img_url,price,cost_price,stock,num,start_time,end_time,a.status')
+                ->where('a.status', '<', $productPopular::STOP)
+                ->where('b.type_id', $kk)
+                ->order('a.status')
+                ->select();
+    
             $resp[] = ['type_id'=>$kk,'title'=>$val, 'product'=>$pro];
         }
+
         $this->success('', $resp);
     }
 
 
+   
+
+
     /**
      * 转让列表
      * sort: 0 默认排序 1价格从高到低 2价格从低到高 

+ 8 - 6
application/common/logic/BonusRewards.php

@@ -63,16 +63,18 @@ class BonusRewards
 
         //读取当日新增数据
         $bonus = self::getDayEarnings($date);
-        if(empty($bonus)){
-            (new Output())->writeln("本次没有可用新增数据:" . $date);
-            return $log_id;
-        }
+        // if(empty($bonus)){
+        //     (new Output())->writeln("本次没有可用新增数据:" . $date);
+        //     return $log_id;
+        // }
         $ledgerWalletModel = new LedgerWalletModel();
         //1.服务津贴
         $recharge_record = UserModel::alias('a')
-        ->join('user b', 'a.parent_id = b.id', 'left')
-        ->field('a.id,sum(a.rwa_num) as total_amount')->having('total_amount >= 10')->group("a.id")
+        ->join('user b', 'a.id = b.parent_id', 'left')
+        ->field('a.id, SUM(a.rwa_num, b.rwa_num) as total_amount')->having('total_amount >= 10')->group("a.id")
         ->select();
+
+        dump( collection($recharge_record)->toArray());die;
         $recharge_count  = count($recharge_record);//总人数
         $pv = bcdiv(bcmul($bonus, config('service_ratio')), $recharge_count, 2); //收益
         foreach ($recharge_record as $info) {

+ 1 - 1
application/common/model/ProductLists.php

@@ -46,7 +46,7 @@ class ProductLists extends Model
     //抢购 ProductPopular
     public function productpopular()
     {
-        return $this->hasOne('ProductPopular', 'product_id', 'id', [], 'LEFT')->order('start_time')->setEagerlyType(0);
+        return $this->hasOne('ProductPopular', 'product_id', 'id', [], 'INNER')->order('start_time')->setEagerlyType(0);
     }
 
         

+ 5 - 1
application/common/model/ProductsModel.php

@@ -19,6 +19,10 @@ class ProductsModel  extends Model
     ];
 
 
-  
+    //产品
+    public function productsList()
+    {
+        return $this->hasMany('ProductLists', 'type_id', 'id');
+    }
 
 }