wupengfei 3 年之前
父節點
當前提交
8f9e5073b9
共有 2 個文件被更改,包括 26 次插入4 次删除
  1. 5 4
      application/api/common.php
  2. 21 0
      application/api/controller/General.php

+ 5 - 4
application/api/common.php

@@ -51,22 +51,23 @@ function change_live_status()
 }
 
 
-function get_month_day(){
+//获取当月日历
+function get_month_days(){
     $date = date('Y-m-d');
     $start_time = strtotime($date);
     $total_month_day = date('t', $start_time);// 当月天数
-    $data = [];
+    $month_data = [];
     $base_data = date("Y-m");
     for($i=1;$i<=$total_month_day;$i++) {
         $c = $i;
         if($c < 10) $c ='0'.$i;
-        $data[] = [
+        $month_data[] = [
             'date_str'=>$base_data.'-'.$c,
             'date' => $i,
             'week' => date('w',strtotime($base_data.'-'.$c))
         ];
     }
-    var_dump($data);
+    return $month_data;
 
 }
 

+ 21 - 0
application/api/controller/General.php

@@ -152,6 +152,27 @@ class General extends Base
         $this->success('ok',['is_sign'=>$ck_sign]);
     }
 
+
+    /**
+     * @title 会员当月日历
+     * @desc  会员当月日历
+     * @author qc
+     * @url /api/General/getUserMonthSign
+     * @method GET
+     * @header name:Authorization require:1 desc:Token
+     */
+    public function getMonthDays()
+    {
+        $month_data = get_month_days();
+        foreach ($month_data as &$v) {
+            $v['is_live'] = Db::table('store_live')
+                ->where('start_at','> time',$v['date_str'].' 00:00:00')
+                ->where('start_at','< time',$v['date_str'].' 23:59:59')
+                ->count();
+        }
+        $this->success('ok',$month_data);
+    }
+
     /**
      * @title 会员当月签到详情
      * @desc  会员当月签到详情