作者 王智

xiugai

@@ -10,6 +10,7 @@ namespace app\api\controller; @@ -10,6 +10,7 @@ namespace app\api\controller;
10 10
11 11
12 use app\common\controller\Api; 12 use app\common\controller\Api;
  13 +use http\Params;
13 use think\Db; 14 use think\Db;
14 15
15 /** 16 /**
@@ -145,4 +146,41 @@ class Content extends Api @@ -145,4 +146,41 @@ class Content extends Api
145 $Arr = Db::name('huodong_content')->where('id', 1)->find(); 146 $Arr = Db::name('huodong_content')->where('id', 1)->find();
146 $this->success('成功', $Arr); 147 $this->success('成功', $Arr);
147 } 148 }
  149 +
  150 +
  151 + /**
  152 + * 富文本接口
  153 + * @ApiTitle (封面海报)
  154 + * @ApiSummary (封面海报)
  155 + * @ApiMethod (POST)
  156 + * @ApiRoute (/api/Content/WaterPaper)
  157 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  158 + * @ApiReturnParams (name="code", type="integer", required=true, sample="0")
  159 + * @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
  160 + * @ApiReturn ({
  161 + 'code':'1',
  162 + 'msg':'返回成功',
  163 + "data": {
  164 + }
  165 + })
  166 + */
  167 + public function WaterPaper()
  168 + {
  169 + $UserId = $this->is_token($this->request->header());
  170 + $start_time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
  171 + $end_time = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y')) - 1;
  172 + $map['createtime'] = ['between', [$start_time, $end_time]];
  173 + $InInfo = Db::name('index_water')->where($map)->where('user_id', $UserId)->find();
  174 + if (empty($InInfo)) {
  175 + $Image = Db::name('water_paper')->where('id', 1)->find();
  176 + $data = [
  177 + 'user_id' => $UserId,
  178 + 'createtime' => time()
  179 + ];
  180 + Db::name('index_water')->insert($data);
  181 + } else {
  182 + $Image = '';
  183 + }
  184 + $this->success('成功', $Image);
  185 + }
148 } 186 }