浏览代码

【修改】修改注释,接口规范

huanglei 3 月之前
父节点
当前提交
326e078a90

+ 2 - 9
app/Http/Controllers/Admin/Article.php

@@ -2,9 +2,7 @@
 
 use App\Http\Requests\Admin\Article as Request;
 use App\Models\Article as Model;
-use App\Models\ArticleComment;
 use Illuminate\Support\Facades\DB;
-use App\Models\City;
 
 /**
  * 分享设置
@@ -24,7 +22,7 @@ class Article extends Auth{
 	 * 首页列表
 	 * 
 	 * */
-    public function index(Model $Model,ArticleComment $ArticleComment){
+    public function index(Model $Model){
 		
 		// 接受参数
 		$code					= request('article_code','');
@@ -82,7 +80,7 @@ class Article extends Auth{
 	 * 添加
 	 * 
 	 * */
-	public function add( Request $request, Model $Model,City $City,Product $Product){
+	public function add( Request $request, Model $Model){
 		if( request()->isMethod('post') ){
 			// 验证参数
 			$request->scene('add')->validate();
@@ -123,11 +121,6 @@ class Article extends Auth{
 				return					json_send(['code'=>'error','msg'=>'内部错误,请重试','data'=>['error'=>$th->getMessage()]]);
 			}
 		}
-		// 获取列表
-		$cityList					= $City->getCityList();
-
-		// 分配数据
-		$this->assign('cityList',$cityList);
 
 		$this->assign('crumbs','新增');
 		// 加载模板

+ 1 - 5
app/Http/Controllers/Admin/ArticleComment.php

@@ -1,7 +1,5 @@
 <?php namespace App\Http\Controllers\Admin;
 
-// use App\Http\Requests\Admin\Article as Request;
-// use App\Models\Article as Model;
 use App\Models\ArticleComment as ArticleCommentModel;
 
 use PhpOffice\PhpSpreadsheet\Cell\DataType;
@@ -9,9 +7,7 @@ use PhpOffice\PhpSpreadsheet\IOFactory;
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
 use PhpOffice\PhpSpreadsheet\Style\Alignment;
 use PhpOffice\PhpSpreadsheet\Style\Fill;
-// use App\Models\Custom as CustomModel;
-// use Illuminate\Support\Facades\DB;
-// use App\Models\City;
+
 
 /**
  * 分享设置

+ 2 - 35
app/Models/Article.php

@@ -1,14 +1,11 @@
 <?php namespace App\Models;
 
-use App\Facades\Servers\Redis\Redis;
-use App\Facades\Servers\Redis\RedisLock;
-use App\Models\Traits\Coupon\GrantType;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Carbon;
 
 /**
- * 优惠券模型
+ * 内容分享模型
  * 
  */
 class Article extends Model
@@ -73,38 +70,8 @@ class Article extends Model
         return 'klyhq'. str_pad($id, 9, '0', STR_PAD_LEFT);
     }
 
-
-    /**
-     * 优惠券过期时间
-     * 
-     * @param  int  $expTime 过期时间
-     * 
-     */
-    public function getExpTime($expTime){
-        // 如果存在过期时间,且小于1000,表示这是一个领取后n天的,按天数返回
-        if ( $expTime && $expTime < 1000 ) return Carbon::now()->addDays($expTime)->endOfDay()->getTimestamp();
-        // 返回时间戳
-        return                          $expTime;
-    }
-
-    /**
-     * 过期状态设置
-     * 
-    */
-    // public function setStatusByExpire(){
-    //     // 上锁
-    //     if(RedisLock::lock('coupon::set::status::by::expire',1,30)){
-    //         // 修改
-    //         $result                 = $this->query()->where([['status','=',0],['end_time','>',0],['end_time','<=',time()]])->update(['status'=>3,'update_time'=>time()]);
-    //         // 不管成功失败,都解锁
-    //         RedisLock::unlock('coupon::set::status::by::expire',1);
-    //         // 返回结果
-    //         return                   $result;
-    //     }
-    // }
-
     /**
-     * 获取优惠券信息
+     * 获取单个信息
      * 
      */
     public function getOne($id,$field=''){

+ 3 - 19
app/Models/ArticleComment.php

@@ -1,6 +1,5 @@
 <?php namespace App\Models;
 
-use App\Facades\Servers\Redis\Redis;
 use App\Facades\Servers\Redis\RedisLock;
 use App\Models\Traits\Coupon\GrantType;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -8,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Support\Carbon;
 
 /**
- * 优惠券模型
+ * 用户操作模型
  * 
  */
 class ArticleComment extends Model
@@ -74,7 +73,7 @@ class ArticleComment extends Model
 
 
     /**
-     * 优惠券过期时间
+     * 过期时间
      * 
      * @param  int  $expTime 过期时间
      * 
@@ -86,24 +85,9 @@ class ArticleComment extends Model
         return                          $expTime;
     }
 
-    /**
-     * 过期状态设置
-     * 
-     */
-    public function setStatusByExpire(){
-        // 上锁
-        if(RedisLock::lock('coupon::set::status::by::expire',1,30)){
-            // 修改
-            $result                 = $this->query()->where([['status','=',0],['end_time','>',0],['end_time','<=',time()]])->update(['status'=>3,'update_time'=>time()]);
-            // 不管成功失败,都解锁
-            RedisLock::unlock('coupon::set::status::by::expire',1);
-            // 返回结果
-            return                   $result;
-        }
-    }
 
     /**
-     * 获取优惠券信息
+     * 获取单个信息
      * 
      */
     public function getOne($id,$field=''){