Преглед на файлове

Merge branch 'liuxiangxin' into jun

jun преди 4 месеца
родител
ревизия
a500fa6ad2

+ 1 - 1
app/Http/Controllers/Admin/AdminUser.php

@@ -182,7 +182,7 @@ class AdminUser extends Auth{
 			// 角色数据
             $ruleData               			= $AdminRule::query()->where([['admin_uid','=',$uid]])->first(['id','admin_uid','menu_type','data_type','type','company_id','business_id']);
 			// 如果不存在的话
-			$ruleData							= $ruleData ? $ruleData->toArray() : ['admin_uid'=>$uid,'menu_type'=>0,'data_type'=>$dataType,'type'=>1,'company_id'=>1,'business_id'=>0];
+			$ruleData							= $ruleData ? $ruleData->toArray() : ['admin_uid'=>$uid,'menu_type'=>1,'data_type'=>$dataType,'type'=>1,'company_id'=>1,'business_id'=>0];
 			// 修改数据
 			if( $dataType ) 					$ruleData['data_type'] = $dataType;
 			if( $session['menu_type'] ) 		$ruleData['menu_type'] = $session['menu_type'];

+ 153 - 0
app/Http/Controllers/Admin/AmountRecord.php

@@ -0,0 +1,153 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Models\Custom as Custom;
+use Illuminate\Support\Carbon;
+use App\Models\Amount\Record as Model;
+
+/**
+ * 余额记录
+ *
+ * @author    jun
+ *
+ */
+class AmountRecord extends Auth{
+
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','余额管理');
+		$this->assign('breadcrumb2','余额记录');
+	}
+
+	/**
+	 * 列表页
+	 * 
+	 * */
+    public function index(Model $Model,Custom $Custom){
+ 		// 接受参数
+		$code					= request('custom_code','');
+		$phone					= request('phone','');
+		$username				= request('username','');
+		$status					= request('status');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 编码转ID
+		$uid					= $Custom->codeToId($code);
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $uid )				$map[] = ['custom.uid','=',$uid];
+		if( $phone )			$map[] = ['custom.phone','=',$phone];
+		if( $username )			$map[] = ['custom.username','=',$username];
+		if( $startTime )		$map[] = ['amount_record.insert_time','>=',Carbon::createFromFormat('Y-m-d',$startTime)->startOfDay()->getTimestamp()];
+		if( $endTime )		    $map[] = ['amount_record.insert_time','<=',Carbon::createFromFormat('Y-m-d',$endTime)->endOfDay()->getTimestamp()];
+		if( !is_null($status) )	$map[] = ['amount_record.status','=',$status];
+		// 查询数据
+		$list					= $Model->query()
+                                    ->leftJoin('custom','custom.uid','=','amount_record.custom_uid')
+                                    ->where($map)
+                                    ->select(['amount_record.*','custom.username'])
+                                    ->orderByDesc('amount_record.id')
+                                    ->paginate(config('page_num',10))
+                                    ->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// id转编号
+			$value['custom_code'] 	= (string) $Custom->idToCode($value['custom_uid']);
+			$value['custom_name'] 	= (string) $Custom->getValue($value['custom_uid'],'username');
+            $value['buy_type']      = (string) $Model->getBuyType($value['buy_type'],'name');
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list',$list);
+		// 加载模板
+		return 						$this->fetch();
+    }
+
+
+	/**
+	 * 导出表格
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom){
+		// 接受参数
+		$code					= request('custom_code','');
+		$phone					= request('phone','');
+		$username				= request('username','');
+		$status					= request('status');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		// 编码转ID
+		$uid					= $Custom->codeToId($code);
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $uid )				$map[] = ['custom.uid','=',$uid];
+		if( $phone )			$map[] = ['custom.phone','=',$phone];
+		if( $username )			$map[] = ['custom.username','=',$username];
+		if( $startTime )		$map[] = ['amount_record.insert_time','>=',Carbon::createFromFormat('Y-m-d',$startTime)->startOfDay()->getTimestamp()];
+		if( $endTime )		    $map[] = ['amount_record.insert_time','<=',Carbon::createFromFormat('Y-m-d',$endTime)->endOfDay()->getTimestamp()];
+		if( !is_null($status) )	$map[] = ['amount_record.status','=',$status];
+		// 查询数据
+		$list					= $Model->query()
+                                    ->leftJoin('custom','custom.uid','=','amount_record.custom_uid')
+                                    ->where($map)
+                                    ->select([
+										'amount_record.id',
+										'amount_record.out_bill_no',
+										'amount_record.transfer_bill_no',
+										'amount_record.prefix',
+										'amount_record.amount',
+										'amount_record.balance',
+										'amount_record.description',
+										'amount_record.buy_type',
+										'amount_record.status',
+										'amount_record.payment_time',
+										'amount_record.insert_time',
+										'amount_record.custom_uid',
+										'custom.username as custom_name',
+									])
+                                    ->orderByDesc('amount_record.id')
+                                    ->limit(10000)->get()->toArray();
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 加减
+			$value['amount'] 		= "'".($value['prefix'] == 1 ? '+'  : '-').$value['amount'];
+			// id转编号
+			$value['custom_uid'] 	= (string) $Custom->idToCode($value['custom_uid']);
+			// id转编号
+            $value['buy_type']      = (string) $Model->getBuyType($value['buy_type'],'name');
+			// 时间
+			$value['payment_time'] 	= $value['payment_time'] ? date('Y-m-d H:i:s',$value['payment_time']) : '';
+			// id转编号
+			$value['insert_time'] 	= $value['insert_time'] ? date('Y-m-d H:i:s',$value['insert_time']) : '';
+			// 删除符号字段
+			unset($value['prefix']);
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 去下载
+		$this->toDown($list);
+	}
+
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// xlsx文件保存路径
+		$excel      		= new \Vtiful\Kernel\Excel(['path' =>public_path().'/uploads/']);
+		$filePath 			= $excel->fileName('tutorial01.xlsx', 'sheet1')->header(['记录ID','系统编号','第三方编号','变动金额','剩余金额','交易描述','交易类型','交易状态','支付时间','交易时间','客户编码','客户昵称'])->data($data)->output();
+		header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		header('Content-Disposition: attachment;filename="客户余额记录.xlsx"');
+		header('Content-Length: ' . filesize($filePath));
+		header('Content-Transfer-Encoding: binary');
+		header('Cache-Control: must-revalidate');
+		header('Cache-Control: max-age=0');
+		header('Pragma: public');
+		ob_clean();
+		flush();
+		// 输出文件,成功删除文件路径
+		if ( copy($filePath, 'php://output') )  @unlink($filePath);
+	}
+}

+ 2 - 2
app/Http/Controllers/Admin/AuthManager.php

@@ -147,8 +147,6 @@ class AuthManager extends Auth{
             $data['rules']			= (array) request('rules',[]);
             // 权限组Id
             $group_id				= (int) request('id',0);
-            // 删除权限
-            DB::table('auth_rule')->where(['group_id'=>$group_id])->delete();
             // 存在权限
             if( isset($data['rules']) ){
                 // 排序
@@ -160,6 +158,8 @@ class AuthManager extends Auth{
             $result 			= DB::table('auth_group')->where(['id'=>$group_id])->update($data);
             // 告知结果
             if( !$result ) 		return	json_send(['code'=>'success','msg'=>'权限组修改失败','action'=>'edit']);
+            // 删除权限
+            DB::table('auth_rule')->where(['group_id'=>$group_id])->delete();
             // 权限组菜单
             $group_menu			= DB::table('auth_group')->find($group_id);
             // 菜单ID

+ 253 - 0
app/Http/Controllers/Admin/CustomRedpacket.php

@@ -0,0 +1,253 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Models\Custom;
+use App\Models\Custom\Redpacket as Model;
+use App\Models\Redpacket\Redpacket;
+use App\Http\Requests\Admin\Custom\Redpacket as Request;
+use App\Models\AdminUser;
+
+/**
+ * 红包管理
+ *
+ * @author    刘相欣
+ *
+ */
+class CustomRedpacket extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','营销管理');
+		$this->assign('breadcrumb2','客户红包');
+	}
+
+	/**
+	 * 首页列表
+	 * 
+	 * */
+    public function index(Model $Model,Custom $Custom,AdminUser $AdminUser){
+		// 接受参数
+		$name					= request('name','');
+		$customCode				= request('custom_code','');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		$status					= request('status');
+		// 编码转ID
+		$customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $name )				$map[] = ['redpacket.name','=',$name];
+		if( $customUid )		$map[] = ['custom_redpacket.custom_uid','=',$customUid];
+		if( $startTime )		$map[] = ['custom_redpacket.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['custom_redpacket.insert_time','<=',strtotime($endTime)];
+		if( !is_null($status) )	$map[] = ['custom_redpacket.status','=',$status];
+		// 查询数据
+		$list					= $Model->query()->join('redpacket','custom_redpacket.redpacket_id','=','redpacket.id')->where($map)
+									->orderBy('custom_redpacket.status')
+									->orderByDesc('custom_redpacket.id')
+									->select(['custom_redpacket.*','redpacket.name as redpacket_name','redpacket.start_time','redpacket.end_time'])
+									->paginate(request('limit',config('page_num',10)))
+									->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// id转编号
+			$value['custom_code'] 	= $Custom->idToCode($value['custom_uid']);
+			// id转编号
+			$value['custom_name'] 	= $Custom->getValue($value['custom_uid'],'username');
+			// id转编号
+			$value['admin_name']  	= $AdminUser->getOne($value['admin_uid'],'username');
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list', $list);
+		// 加载模板
+		return						$this->fetch();
+    }
+
+
+	/**
+	 * 发放红包
+	 * 
+	 * */
+	public function add(Request $request,Model $Model,Redpacket $Redpacket,Custom $Custom){
+		// 红包ID
+		$redpacketId				= request('redpacket_id',0);
+		// 添加
+		if( request()->isMethod('post') ){
+			// 验证参数
+			$request->scene('add')->validate();
+			// 接收数据
+			$redpacketId				= request('redpacket_id',0);
+			$customCodes				= request('custom_codes','');
+			// 如果操作失败
+			if( !$redpacketId ) 		return json_send(['code'=>'error','msg'=>'请选择正确的活动ID']);
+			// 查询红包信息
+			$redpacketInfo				= $Redpacket->query()->find($redpacketId);
+			// 提示
+			if( !$redpacketInfo )		return json_send(['code'=>'error','msg'=>'未找到对应的活动']);
+			// 兼容逗号问题
+			$customCodes				= str_ireplace(',',',',$customCodes);
+			$customCodes				= str_ireplace("\r\n",',',$customCodes);
+			$customCodes				= str_ireplace("\n",',',$customCodes);
+			// 转数组处理
+			$customCodes				= explode(',',$customCodes);
+			// 循环处理
+			foreach ($customCodes as $key=>$value) {
+				// 转ID
+				$customUid				= $Custom->codeToId($value);
+				// id有问题
+				if( !$customUid )		return json_send(['code'=>'error','msg'=>'客户编码'.$value.'不存在']);
+				// 重组
+				$customCodes[$key]  	= $customUid;
+			}
+			// 去重
+			$customCodes				= array_unique($customCodes);
+			// 数量
+			if(  count($customCodes) > 1000 )  return json_send(['code'=>'error','msg'=>'客户编码请勿超过1000']);
+			// 排除数据
+			$customCodes				= is_array($customCodes) ? $customCodes : [];
+			// 插入列表
+			$insertList					= [];
+			// 时间
+			$time 						= time();
+			// 循环客户
+			foreach ($customCodes as $key => $value) {
+				// 是否存在已发放的客户
+				$oldId					= $Model->query()->where([['redpacket_id','=',$redpacketId],['custom_uid','=',$value]])->value('id');
+				// 如果存在ID
+				if( $oldId )			continue;
+				// 批量写入列表
+				$insertList[]			= ['redpacket_id'=>$redpacketId,'custom_uid'=>$value,'money'=>$redpacketInfo['money'],'admin_uid'=>admin('uid'),'insert_time'=>$time,'update_time'=>$time];
+			}
+			// 如果有客户范围
+			if( $insertList )			{
+				// 分块,每1000一批写入
+				foreach (array_chunk($insertList,1000) as $chunk) {
+					// 写入数据
+					$result 			= $Model->insert($chunk);
+					// 提示新增失败
+					if( !$result )		{
+						// 提示失败
+						return			json_send(['code'=>'error','msg'=>'指定客户写入失败']);
+					}
+				}
+			}
+			// 告知结果
+			return					json_send(['code'=>'success','msg'=>'新增成功','action'=>'add','path'=>url('admin/custom_redpacket/index?'.http_build_query(['redpacket_id'=>$redpacketId]))]);
+		}
+		// 提示
+		if( !$redpacketId )			return $this->error('请选择正确的活动ID');
+		// 查询红包信息
+		$redpacketInfo				= $Redpacket->query()->find($redpacketId);
+		// 提示
+		if( !$redpacketId )			return $this->error('未找到对应的活动');
+		// 分配数据
+		$this->assign('crumbs','发放红包');
+		$this->assign('redpacketInfo',$redpacketInfo);
+		// 加载模板
+		return						$this->fetch(); 
+	}
+
+
+	/**
+	 * 状态
+	 * 
+	 * */
+	public function set_status( Request $request, Model $Model){
+		// 验证参数
+		$request->scene('set_status')->validate();
+		// 接收参数
+		$id				= request('id',0);
+		$status			= request('status',0);
+		// 查询数据
+		$result			= $Model->edit($id,['status'=>$status]);
+		// 提示新增失败
+		if( !$result )	return json_send(['code'=>'error','msg'=>'设置失败']);
+		// 记录行为
+		$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,[],['status'=>$status]);
+		// 告知结果
+		return			json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+	}
+	
+	/**
+	 * 导出表格
+	 * 
+	 * */
+	public function down_excel(Model $Model,Custom $Custom,AdminUser $AdminUser){
+		// 接受参数
+		$name					= request('name','');
+		$customCode				= request('custom_code','');
+		$startTime				= request('start_time','');
+		$endTime				= request('end_time','');
+		$status					= request('status');
+		// 编码转ID
+		$customUid				= $customCode ? $Custom->codeToId($customCode) : 0;
+		// 查询条件
+		$map 					= [];
+		// 编码ID
+		if( $name )				$map[] = ['redpacket.name','=',$name];
+		if( $customUid )		$map[] = ['custom_redpacket.custom_uid','=',$customUid];
+		if( $startTime )		$map[] = ['custom_redpacket.insert_time','>=',strtotime($startTime)];
+		if( $endTime )			$map[] = ['custom_redpacket.insert_time','<=',strtotime($endTime)];
+		if( !is_null($status) )	$map[] = ['custom_redpacket.status','=',$status];
+		// 查询数据
+		$list					= $Model->query()->join('redpacket','custom_redpacket.redpacket_id','=','redpacket.id')->where($map)
+									->orderBy('custom_redpacket.status')
+									->orderByDesc('custom_redpacket.id')
+									->select([
+										'custom_redpacket.id',
+										'custom_redpacket.redpacket_id',
+										'custom_redpacket.money',
+										'custom_redpacket.status',
+										'custom_redpacket.get_time',
+										'redpacket.name as redpacket_name',
+										'redpacket.start_time',
+										'redpacket.end_time',
+										'custom_redpacket.admin_uid',
+										'custom_redpacket.custom_uid',
+										])
+									->limit(10000)->get()->toArray();
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// id转编号
+			$value['custom_code'] 	= (string)$Custom->idToCode($value['custom_uid']);
+			// id转编号
+			$value['custom_uid'] 	= (string)$Custom->getValue($value['custom_uid'],'username');
+			// 操作人员
+			$value['admin_uid']  	= (string)$AdminUser->getOne($value['admin_uid'],'username');
+			// 时间
+			$value['get_time'] 		= $value['get_time'] ? date('Y-m-d H:i:s',$value['get_time']) : '';
+			// id转编号
+			$value['start_time'] 	= $value['start_time'] ? date('Y-m-d H:i:s',$value['start_time']) : '';
+			// id转编号
+			$value['end_time']  	= $value['end_time'] ? date('Y-m-d H:i:s',$value['end_time']) : '';
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 去下载
+		$this->toDown($list);
+	}
+
+	/**
+	 * 去下载
+	 */
+	private function  toDown($data){
+		// xlsx文件保存路径
+		$excel      		= new \Vtiful\Kernel\Excel(['path' =>public_path().'/uploads/']);
+		$filePath 			= $excel->fileName('tutorial01.xlsx', 'sheet1')->header(['记录ID','活动ID','红包金额','领取状态','领取时间','活动名称','开始时间','结束时间','操作人员','客户昵称','客户编码'])->data($data)->output();
+		header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+		header('Content-Disposition: attachment;filename="客户红包记录.xlsx"');
+		header('Content-Length: ' . filesize($filePath));
+		header('Content-Transfer-Encoding: binary');
+		header('Cache-Control: must-revalidate');
+		header('Cache-Control: max-age=0');
+		header('Pragma: public');
+		ob_clean();
+		flush();
+		// 输出文件,成功删除文件路径
+		if ( copy($filePath, 'php://output') )  @unlink($filePath);
+	}
+
+}

+ 2 - 0
app/Http/Controllers/Admin/ImageManager.php

@@ -104,6 +104,8 @@ class ImageManager extends Auth{
 		if( !preg_match('/^[A-Za-z0-9\_\.]+$/',$folder) ) return ['error'=>$folder.' 文件夹仅支持字母数字_组合'];
 		// 验证是否有这个文件夹
 		$directory					= $directory ? $this->upload_url.'/' : $this->upload_url.'/';
+		// 上级目录
+		$count						= 0;
 		// 替换上级目录
 		$folder 					= str_replace(['../', '..\\', '..'],'',$folder,$count);
 		// 有上级目录

+ 4 - 70
app/Http/Controllers/Admin/Orders.php

@@ -13,11 +13,6 @@ use App\Models\OrdersAddr;
 use App\Models\OrdersProduct;
 use App\Models\Business;
 use Illuminate\Support\Facades\DB;
-use PhpOffice\PhpSpreadsheet\Cell\DataType;
-use PhpOffice\PhpSpreadsheet\IOFactory;
-use PhpOffice\PhpSpreadsheet\Spreadsheet;
-use PhpOffice\PhpSpreadsheet\Style\Alignment;
-use PhpOffice\PhpSpreadsheet\Style\Fill;
 use Intervention\Image\Facades\Image;
 use Intervention\Image\Gd\Font;
 use App\Models\Custom\Shoptype;
@@ -542,76 +537,15 @@ class Orders extends Auth{
             ob_clean();
             flush();
             if (copy($filePath, 'php://output') === false) {
-                return			json_send(['code'=>'error','msg'=>'下载失败']);
+                dd('下载出错');
             }
             @unlink($filePath);
-            return			json_send(['code'=>'success','msg'=>'下载成功','path'=>'']);
-        }catch (\Exception  $exception) {
-            return			json_send(['code'=>'error','msg'=>'下载失败']);
+            exit();
+        }catch (\Throwable $th) {
+            return $th->getMessage();
         }
 	}
 
-	/**
-	 * 设置表格样式
-	 * 
-	 */
-	private function setStyle(Spreadsheet $spreadsheet){
-		// 选择当前活动的工作表
-		$sheet					= $spreadsheet->getActiveSheet();
-		// 宽
-		$sheet->getColumnDimension('A')->setWidth(15);
-		$sheet->getColumnDimension('B')->setWidth(15);
-		$sheet->getColumnDimension('C')->setWidth(15);
-		$sheet->getColumnDimension('D')->setWidth(15);
-		$sheet->getColumnDimension('E')->setWidth(15);
-		$sheet->getColumnDimension('F')->setWidth(15);
-		$sheet->getColumnDimension('G')->setWidth(15);
-		$sheet->getColumnDimension('H')->setWidth(15);
-		$sheet->getColumnDimension('I')->setWidth(15);
-		$sheet->getColumnDimension('J')->setWidth(50);
-		$sheet->getColumnDimension('K')->setWidth(15);
-		$sheet->getColumnDimension('L')->setWidth(20);
-		$sheet->getColumnDimension('M')->setWidth(80);
-		$sheet->getColumnDimension('N')->setWidth(80);
-		$sheet->getColumnDimension('O')->setWidth(10);
-		$sheet->getColumnDimension('P')->setWidth(10);
-		$sheet->getColumnDimension('Q')->setWidth(10);
-		$sheet->getColumnDimension('R')->setWidth(10);
-		$sheet->getColumnDimension('S')->setWidth(10);
-		$sheet->getColumnDimension('T')->setWidth(50);
-		$sheet->getColumnDimension('U')->setWidth(20);
-		// 默认高度
-		$sheet->getDefaultRowDimension()->setRowHeight(18);
-		// 加粗第一行
-		$sheet->getStyle('A:U')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER)->setVertical(Alignment::VERTICAL_CENTER);
-		$sheet->getStyle('A1:U1')->getFont()->setBold(true);
-		$sheet->getStyle('A1:U1')->getFill()->setFillType(Fill::FILL_SOLID)->getStartColor()->setARGB('FF00FF00'); // ARGB颜色代码,例如绿色
-		// 设置表格标题
-		$sheet
-		->setCellValue('A1', '订单ID')
-		->setCellValue('B1', '客户ID')
-		->setCellValue('C1', '客户昵称')
-		->setCellValue('D1', '订单状态')
-		->setCellValue('E1', '收货人')
-		->setCellValue('F1', '收货人手机号')
-		->setCellValue('G1', '省')
-		->setCellValue('H1', '市')
-		->setCellValue('I1', '区县')
-		->setCellValue('J1', '收货地址')
-		->setCellValue('K1', '终端类型')
-		->setCellValue('L1', '产品编码')
-		->setCellValue('M1', '产品名称')
-		->setCellValue('N1', '产品规格')
-		->setCellValue('O1', '产品单价')
-		->setCellValue('P1', '折后单价')
-		->setCellValue('Q1', '产品数量')
-		->setCellValue('R1', '优惠金额')
-		->setCellValue('S1', '产品金额')
-		->setCellValue('T1', '微伴ID')
-		->setCellValue('U1', '下单时间');
-		// 返回结果
-		return 					$sheet;
-	}
 
 	/**
 	 * 分享图片

+ 2 - 0
app/Http/Controllers/Admin/Product.php

@@ -738,6 +738,8 @@ class Product extends Auth{
 			$cityIds				= $cityIds ? $cityIds : [1];
 			$data['quota_start']	= $data['quota_start'] ? strtotime($data['quota_start']) : 0;
 			$data['quota_end']		= $data['quota_end'] ? strtotime($data['quota_end']) : 0;
+			$data['puton_time']		= $data['puton_time'] ? strtotime($data['puton_time']) : 0;
+			$data['putoff_time']	= $data['putoff_time'] ? strtotime($data['putoff_time']) : 0;
 			// 限购提示
 			if( !$data['thumb'] ) 	return json_send(['code'=>'error','msg'=>'请上传产品主图','data'=>['error'=>'请上传产品主图']]);
 			// 限购提示

+ 156 - 0
app/Http/Controllers/Admin/Redpacket.php

@@ -0,0 +1,156 @@
+<?php namespace App\Http\Controllers\Admin;
+
+use App\Http\Requests\Admin\Redpacket\Redpacket as Request;
+use App\Models\Redpacket\Redpacket as Model;
+use Illuminate\Support\Facades\DB;
+
+/**
+ * 优惠券管理
+ *
+ * @author    刘相欣
+ *
+ */
+class Redpacket extends Auth{
+	
+	protected function _initialize(){
+		parent::_initialize();
+		$this->assign('breadcrumb1','营销管理');
+		$this->assign('breadcrumb2','红包活动');
+	}
+
+	/**
+	 * 首页列表
+	 * 
+	 * */
+    public function index(Model $Model){
+		// 接受参数
+		$name						= request('name','');
+		$status						= request('status');
+		$startTime					= request('start_time','');
+		$endTime					= request('end_time','');
+		// 查询条件
+		$map 						= [];
+		// 编码ID
+		if( $name )					$map[] = ['name','=',$name];
+		if( $startTime )			$map[] = ['start_time','>=',strtotime($startTime)];
+		if( $endTime )				$map[] = ['end_time','<=',strtotime($endTime)];
+		if( !is_null($status) )		$map[] = ['status','=',$status];
+		// 查询数据
+		$list						= $Model->query()->where($map)->orderByDesc('id')->paginate(request('limit',config('page_num',10)))->appends(request()->all());
+		// 循环处理数据
+		foreach ($list as $key => $value) {
+			// 重组
+			$list[$key]				= $value;
+		}
+		// 分配数据
+		$this->assign('empty', '<tr><td colspan="20">~~暂无数据</td></tr>');
+		$this->assign('list', $list);
+		// 加载模板
+		return					$this->fetch();
+    }
+
+	/**
+	 * 添加
+	 * 
+	 * */
+	public function add( Request $request, Model $Model){
+		if( request()->isMethod('post') ){
+			// 验证参数
+			$request->scene('add')->validate();
+			// 组合数据
+			$data['name']			= request('name',0);
+			$data['money']			= request('money',0);
+			$data['active_rule']	= request('active_rule','');
+			$data['start_time']		= request('start_time','');
+			$data['end_time'] 		= request('end_time','');
+			$data['status']			= request('status',1);
+			// 转换时间,默认现在现在生效
+			$data['start_time']		= $data['start_time'] ? strtotime($data['start_time']) : time();
+			$data['end_time']		= $data['end_time'] ? strtotime($data['end_time']) : 0;
+			// 验证信息
+			if( $data['start_time'] <= 0 ) return json_send(['code'=>'error','msg'=>'请填写活动开始时间']);
+			if( $data['end_time'] 	< time() ) return json_send(['code'=>'error','msg'=>'活动结束时间必须大于当前时间']);
+			if( $data['end_time'] 	<= $data['start_time'] ) return json_send(['code'=>'error','msg'=>'活动结束时间必须大于开始时间']);
+			// 写入
+			$id						= $Model->add($data);
+			// 提示新增失败
+			if( !$id )				return json_send(['code'=>'error','msg'=>'新增失败']);
+			// 记录行为
+			$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,1,[],$data);
+			// 告知结果
+			return					json_send(['code'=>'success','msg'=>'新增成功','action'=>'add']);
+		}
+		// 获取列表
+		$this->assign('crumbs','新增');
+		// 加载模板
+		return 						$this->fetch();
+	}
+	
+	/**
+	 * 编辑
+	 * 
+	 * */
+	public function edit( Request $request, Model $Model){
+		// 接收参数
+		$id							= request('id',0);
+		// 查询数据
+		$oldData					= $Model->where(['id'=>$id])->first();
+		// 修改
+		if(request()->isMethod('post')){
+			// 验证参数
+			$request->scene('edit')->validate();
+			// 组合数据
+			$data['name']			= request('name',0);
+			$data['money']			= request('money',0);
+			$data['active_rule']	= request('active_rule','');
+			$data['start_time']		= request('start_time','');
+			$data['end_time'] 		= request('end_time','');
+			$data['status']			= request('status',1);
+			// 转换时间,默认现在现在生效
+			$data['start_time']		= $data['start_time'] ? strtotime($data['start_time']) : time();
+			$data['end_time']		= $data['end_time'] ? strtotime($data['end_time']) : 0;
+			// 验证信息
+			if( $data['start_time'] <= 0 ) return json_send(['code'=>'error','msg'=>'请填写活动开始时间']);
+			if( $data['end_time'] 	< time() ) return json_send(['code'=>'error','msg'=>'活动结束时间必须大于当前时间']);
+			if( $data['end_time'] 	<= $data['start_time'] ) return json_send(['code'=>'error','msg'=>'活动结束时间必须大于开始时间']);
+			// 写入
+			$result					= $Model->edit($id,$data);
+			// 提示新增失败
+			if( !$result )			return json_send(['code'=>'error','msg'=>'新增失败']);
+			// 记录行为
+			$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,$oldData,$data);
+			// 告知结果
+			return				json_send(['code'=>'success','msg'=>'修改成功','action'=>'edit']);
+		}
+		// 如果是没有数据
+		if( !$oldData ) 			return $this->error('查无数据');
+		// 分配数据
+		$this->assign('oldData',$oldData);
+		$this->assign('crumbs','修改');
+		// 加载模板
+		return 					$this->fetch();
+	}
+
+	/**
+	 * 状态
+	 * 
+	 * */
+	public function set_status( Request $request, Model $Model){
+		// 验证参数
+		$request->scene('set_status')->validate();
+		// 接收参数
+		$id					= request('id',0);
+		$status				= request('status',0);
+		// 查询数据
+		$result				= $Model->edit($id,['status'=>$status]);
+		// 提示新增失败
+		if( !$result )		return json_send(['code'=>'error','msg'=>'设置失败']);
+		// 查询数据
+		// $result			= $RedpacketCustom->setStatusByRedpacketId($id,$status);
+		// 记录行为
+		$this->addAdminHistory(admin('uid'),$Model->getTable(),$id,2,[],['status'=>$status]);
+		// 告知结果
+		return				json_send(['code'=>'success','msg'=>'设置成功','path'=>'']);
+	}
+
+}

+ 51 - 6
app/Http/Controllers/Api/CustomAddr.php

@@ -6,6 +6,7 @@ use App\Http\Requests\Api\CustomAddr as Request;
 use App\Models\City;
 use App\Models\Custom;
 use App\Models\WeiBan\Follow as WeiBanFollow;
+use App\Facades\Servers\WeiBan\OpenApi;
 
 /**
  * 客户地址
@@ -39,13 +40,19 @@ class CustomAddr extends Api{
 	 * @param	string		$code		授权码
 	 * 
 	 * */
-	public function add(Request $request,Model $Model,Custom $Custom,City $City){
+	public function add(Request $request,Model $Model,Custom $Custom,City $City,WeiBanFollow $WeiBanFollow){
 		// 接口验签
 		// $this->verify_sign();
 		// 验证参数
 		$request->scene('add')->validate();
 		// 检查登录
 		$uid							= $this->checkLogin();
+		// 获取客户信息
+		$custom							= $Custom->getOne($uid);
+		// 如果客户信息不存在的话
+		if( !$custom )					return json_send(['code'=>'error','msg'=>'客户信息不存在','data'=>['error'=>'客户信息不存在']]);
+		// 如果用户状态被拉黑,不允许登录
+		if( $custom['status'] )			return json_send(['code'=>'error','msg'=>'禁用账号','data'=>['error'=>'禁用账号']]);
 		// 接收参数
 		$data['contact_province']		= trim(request('contact_province',''));
 		$data['contact_city']			= trim(request('contact_city',''));
@@ -57,11 +64,9 @@ class CustomAddr extends Api{
 		$data['contact_phone']			= trim(request('contact_phone',''));
 		$data['is_default']				= request('is_default',0);
 		$data['custom_uid']				= $uid;
-		// 获取客户城市ID
-		$cityId							= (int) $Custom->getValue($uid,'city_id');
-		$cityName						= $City->getOne($cityId,'name');
-		$pid 							= $City->getOne($cityId,'pid');
-		$province						= $City->getOne($pid,'name');
+		$cityName						= $custom['city_id'] ? $City->getOne($custom['city_id'],'name') : '';
+		$pid 							= $custom['city_id'] ? $City->getOne($custom['city_id'],'pid') : 0;
+		$province						= $pid ? $City->getOne($pid,'name') : '';
 		// 判断选择的城市名称是不是一致
 		if( trim($cityName) != trim($data['contact_city']) ) return json_send(['code'=>'error','msg'=>'收货地址请选择'.($province=='直辖县级'?$cityName:$province).'/'.$cityName,'data'=>['error'=>'收货地址需与您所选城市一致']]);
 		// 替换地址中间的空格
@@ -77,11 +82,51 @@ class CustomAddr extends Api{
 		$result							= $Model->add($data);
 		// 如果用户状态被拉黑,不允许登录
 		if( !$result )					return json_send(['code'=>'error','msg'=>'保存失败,请重试','data'=>['error'=>'写入失败']]);
+		// 如果存在微伴ID
+		if( !$custom['weiban_extid'] )	return json_send(['code'=>'success','msg'=>'保存成功','data'=>$data]);
+		// 获取客服对应的备注等信息
+		$staffId						= $WeiBanFollow->query()->where([['weiban_extid','=',$custom['weiban_extid']]])->value('staff_id');
+		// 如果存在微伴ID
+		if( !$staffId )					return json_send(['code'=>'success','msg'=>'保存成功','data'=>$data]);
+		// 自动标签
+		if( !$havaNum )					$this->autoTags($province,$cityName,$data['shop_type'],$staffId,$custom['weiban_extid']);
 		// 返回结果
 		return							json_send(['code'=>'success','msg'=>'保存成功','data'=>$data]);
 	}
 
 
+	/**
+     * 自动标签
+     */
+    private function autoTags($province,$cityName,$shopType,$staffId,$weibanExtid){
+		// 如果有地址信息
+        switch ($shopType)          {
+            case '1':
+            $shopType               = '单店';
+            break;
+            case '2':
+            $shopType               = '连锁';
+            break;
+            case '3':
+            $shopType               = '第三终端';
+            break;
+            default:
+            $shopType               = '';
+            break;
+        }
+        // 省份
+        $province                   = str_ireplace(['自治区','壮族','回族','维吾尔','特别行政区','省'],'',$province);
+        // 省份
+        $cityName                   = str_ireplace(['自治州','自治县','蒙古','蒙古族','回族','藏族','维吾尔','苗族','彝族','壮族','布依族','朝鲜族','满族','侗族','瑶族','白族','土家族','哈尼族','哈萨克','傣族','黎族','傈僳族','佤族','畲族','拉祜族','水族','东乡族','纳西族','景颇族','柯尔克孜','土族','达斡尔族','仫佬族','羌族','布朗族','撒拉族','毛南族','仡佬族','锡伯','阿昌族','普米族','塔吉克','怒族','鄂温克族','德昂族','保安族','裕固族','塔塔尔','独龙族'],'',$cityName);
+       	// 打标签
+		if( $province ) 			OpenApi::addTag($staffId,$weibanExtid,'省份',$province);
+        if( $cityName ) 			OpenApi::addTag($staffId,$weibanExtid,$province,$cityName);
+		if( $shopType ) 			OpenApi::addTag($staffId,$weibanExtid,'企业类型',$shopType);
+        // 返回结果
+        return                      ['success'=>'返回结果'];
+    }
+
+
 	/**
 	 * 修改			/api/custom_addr/edit
 	 * 

+ 46 - 0
app/Http/Requests/Admin/Amount/Record.php

@@ -0,0 +1,46 @@
+<?php namespace App\Http\Requests\Admin\Amount;
+
+use App\Http\Requests\BaseRequest;
+
+/**
+ * 发放规则验证器
+ * 
+ */
+class Record extends BaseRequest
+{
+    /**
+     * 获取应用于请求的规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        // 返回结果
+        return      [
+            // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则,只需要将 bail 添加到规则中:
+            // 验证字段,验证规则,提示信息
+	        'id'                => 'required|integer|gt:0',
+        ];
+    }
+
+    
+    // 场景列表
+    protected   $scenes         = [
+        'set_status'  		    => ['id'],
+	];
+
+    /**
+     * 获取已定义验证规则的错误消息
+     *
+     * @return array
+     */
+    public function messages()
+    {
+        return [
+            'id.required'       => 'ID未知',
+            'id.integer'        => 'ID格式错误',
+            'id.gt'   		    => 'ID格式错误',
+        ];
+    }
+    
+}

+ 56 - 0
app/Http/Requests/Admin/Custom/Redpacket.php

@@ -0,0 +1,56 @@
+<?php namespace App\Http\Requests\Admin\Custom;
+
+use App\Http\Requests\BaseRequest;
+/**
+ * 入库验证器
+ * 
+ */
+class Redpacket extends BaseRequest
+{
+    /**
+     * 获取应用于请求的规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        // 编辑时排除ID
+        // 返回结果
+        return      [
+            // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则,只需要将 bail 添加到规则中:
+            // 验证字段,验证规则,提示信息
+            'id'            => 'required|integer|gt:0',
+            'redpacket_id'  => 'required|integer|gt:0',
+            'custom_codes'  => 'required',
+            'status'        => 'required|integer|gte:0',
+        ];
+    }
+
+    // 场景列表
+    protected   $scenes         = [
+        'add'                   => ['redpacket_id','custom_codes'],
+        'set_status'            => ['id','status'],
+	];
+
+    /**
+     * 获取已定义验证规则的错误消息
+     *
+     * @return array
+     */
+    public function messages()
+    {
+        return [
+            'id.required'   		    => 'ID未知',
+            'id.integer'   		        => 'ID格式错误',
+            'id.gt'   		            => 'ID格式错误',
+            'redpacket_id.required'   	=> '请选择红包活动',
+            'redpacket_id.integer'   	=> '活动ID格式错误',
+            'redpacket_id.gt'   		=> '活动ID格式错误',
+            'custom_codes.required'   	=> '请填写发放对象用户编码',
+            'status.required'   		=> '请选择状态',
+            'status.integer'   		    => '状态格式错误',
+            'status.gte'   		        => '状态格式错误',
+        ];
+    }
+
+}

+ 54 - 0
app/Http/Requests/Admin/Redpacket/Redpacket.php

@@ -0,0 +1,54 @@
+<?php namespace App\Http\Requests\Admin\Redpacket;
+
+use App\Http\Requests\BaseRequest;
+/**
+ * 入库验证器
+ * 
+ */
+class Redpacket extends BaseRequest
+{
+    /**
+     * 获取应用于请求的规则
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        // 编辑时排除ID
+        // 返回结果
+        return      [
+            // 有时候我们希望某个字段在第一次验证失败后就停止运行验证规则,只需要将 bail 添加到规则中:
+            // 验证字段,验证规则,提示信息
+            'id'            => 'required|integer|gt:0',
+            'name' 			=> 'required|unique:redpacket,name,'.request('id',0),
+            'status'        => 'required|integer|gte:0',
+        ];
+    }
+
+    // 场景列表
+    protected   $scenes         = [
+        'add'                   => ['name'],
+        'edit'                  => ['id','name'],
+        'set_status'            => ['id','status'],
+	];
+
+    /**
+     * 获取已定义验证规则的错误消息
+     *
+     * @return array
+     */
+    public function messages()
+    {
+        return [
+            'id.required'   		    => 'ID未知',
+            'id.integer'   		        => 'ID格式错误',
+            'id.gt'   		            => 'ID格式错误',
+            'name.required'             => '活动名称必填',
+            'name.unique'	            => '活动名称已存在',
+            'status.required'   		=> '请选择状态',
+            'status.integer'   		    => '状态格式错误',
+            'status.gte'   		        => '状态格式错误',
+        ];
+    }
+
+}

+ 2 - 2
app/Jobs/WeiBanSync.php

@@ -254,10 +254,10 @@ class WeiBanSync implements ShouldQueue
             case '1':
             $shopType               = '单店';
             break;
-            case '3':
+            case '2':
             $shopType               = '连锁';
             break;
-            case '4':
+            case '3':
             $shopType               = '第三终端';
             break;
             default:

+ 55 - 0
app/Models/Amount/Record.php

@@ -0,0 +1,55 @@
+<?php namespace App\Models\Amount;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+use App\Models\Traits\Amount\BuyType;
+/**
+ * 发放规则模型
+ * 
+ */
+class Record extends Model
+{
+    use HasFactory,BuyType;
+
+    // 与模型关联的表名
+    protected   $table = 'amount_record';
+    // 是否主动维护时间戳
+    public      $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        // 如果操作失败
+        if( !$id )                          return $id;
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 如果操作失败
+        if( !$result )                      return $result;
+        // 返回结果
+        return                              $result;
+    }
+
+}

+ 70 - 0
app/Models/Custom/Redpacket.php

@@ -0,0 +1,70 @@
+<?php namespace App\Models\Custom;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * 客户红包模型
+ * 
+ */
+class Redpacket extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'custom_redpacket';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        // 如果操作失败
+        if( !$id )                          return 0;
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 如果操作失败
+        if( !$result )                      return 0;
+        // 返回结果
+        return                              $id;
+    }
+
+    
+
+    /**
+     * 获取优惠券信息
+     * 
+     */
+    public function getOne($id,$field=''){
+        // 返回结果
+        $result                      = $this->query()->find($id);
+        // 返回结果
+        $result                      = $result ? $result->toArray() : [];
+        // 返回值
+        return                       empty($field) ? $result : ( isset($result[$field]) ? $result[$field] : null);
+    }
+
+}

+ 110 - 0
app/Models/Redpacket/Redpacket.php

@@ -0,0 +1,110 @@
+<?php namespace App\Models\Redpacket;
+
+use Illuminate\Database\Eloquent\Factories\HasFactory;
+use Illuminate\Database\Eloquent\Model;
+
+/**
+ * 优惠券模型
+ * 
+ */
+class Redpacket extends Model
+{
+    use HasFactory;
+
+    // 与模型关联的表名
+    protected $table = 'redpacket';
+    // 是否主动维护时间戳
+    public $timestamps = false;
+    // 定义时间戳字段名
+    // const CREATED_AT = 'insert_time';
+    // const UPDATED_AT = 'update_time';
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function add($data)
+    {
+        // 时间
+        $data['insert_time']				= time();
+        $data['update_time']				= time();
+        // 写入数据表
+        $id						            = $this->query()->insertGetId($data);
+        // 如果操作失败
+        if( !$id )                          return 0;
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $id;
+    }
+
+    /**
+     * 添加数据
+     * 
+     */
+    public function edit($id,$data)
+    {
+        // 更新时间
+        $data['update_time']                = time();
+        // 写入数据表
+        $result						        = $this->query()->where(['id'=>$id])->update($data);
+        // 如果操作失败
+        if( !$result )                      return 0;
+        // 更新缓存
+        $this->getList(true);
+        // 返回结果
+        return                              $id;
+    }
+
+    
+    /**
+     * 获取优惠券信息
+     * 
+     */
+    /**
+     * 获取列表
+     * @param   Bool    $force  是否强制更新
+     * 
+     */
+    public function getList($force = false)
+    {
+        // 结果数据
+        $list                  = $force ? [] : cache('admin:redpack:list');
+        // 不存在数据
+        if ( !$list ) {
+            // 从数据库获取数据
+            $data              = $this->query()->where([['status','=',0]])->get(['id','name','status','active_rule','money','start_time','end_time']);
+            // 是否有数据
+            $data              = $data ? $data->toArray() : [];
+            // 循环处理数据
+            $list              = [];
+            // 进行更新
+            foreach ($data as $value) {
+                // 重组数据
+                $list[$value['id']] = $value;
+            }
+            // 存起来
+            cache(['admin:redpack:list'=>$list]);
+        }
+        // 返回结果
+        return                  $list;
+    }
+
+    /**
+     * 获取配置平台对应的应用数据
+     * 
+     * @param   int      用户ID
+     * @param   string     指定字段
+     * 
+     */
+    public function getOne($id,$field='')
+    {
+        // 获取列表数据
+        $list                   = $this->getList();
+        // 获取数据
+        $one                    = isset($list[$id]) ? $list[$id] : [];
+        // 返回值
+        return                  empty($field) ? $one : ( isset($one[$field]) ? $one[$field] : null);
+    }
+
+}

+ 10 - 4
app/Models/Traits/Amount/BuyType.php

@@ -15,15 +15,21 @@ trait BuyType
     private     $buyType        =   ['1'=>[
                                         'id'            =>1,
                                         // 类型名称
-                                        'name'          =>'领取红包',
+                                        'name'          =>'红包奖励',
                                         // 支付方式  方式名称
-                                        'pay_type'      =>['1'=>['id'=>1,'name'=>'领取红包']],
+                                        'pay_type'      =>['1'=>['id'=>1,'name'=>'红包奖励']],
                                     ],'2'=>[
                                         'id'            =>2,
                                         // 类型名称
-                                        'name'          =>'提现',
+                                        'name'          =>'余额提现',
                                         // 支付方式  方式名称
-                                        'pay_type'  =>['1'=>['id'=>1,'name'=>'提现']],
+                                        'pay_type'  =>['1'=>['id'=>1,'name'=>'余额提现']],
+                                    ], '3'=>[
+                                        'id'            =>1,
+                                        // 类型名称
+                                        'name'          =>'系统操作',
+                                        // 支付方式  方式名称
+                                        'pay_type'      =>['1'=>['id'=>1,'name'=>'系统操作']],
                                     ]];
 
     /**

+ 2 - 2
config/session.php

@@ -31,9 +31,9 @@ return [
     |
     */
 
-    'lifetime' => env('SESSION_LIFETIME', 1440),
+    'lifetime' => env('SESSION_LIFETIME', 480),
 
-    'expire_on_close' => false,
+    'expire_on_close' => true,
 
     /*
     |--------------------------------------------------------------------------

+ 71 - 0
resources/views/admin/amount_record/index.blade.php

@@ -0,0 +1,71 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+
+<form action="" method="get" class="form-horizontal form-line" name="thisform">
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码" />
+	</div>
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="custom_name" value="{{request('custom_name','')}}" placeholder="请输入客户名称查询" />
+	</div>
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
+		<input type="date" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
+	</div>
+	<div class="form-group col col-lg-2 col-md-4 col-sm-6 col-xs-12" style="margin-right: 2px;">
+		<input type="date" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束查询" />
+	</div>
+	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
+	<a href="{{url('admin/amount_record/index')}}" class="btn btn-sm btn-default" >重置</a>
+	@if( check_auth('admin/amount_record/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/amount_record/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载</button>
+	@endif
+</form>
+
+<div class="row">
+	<div class="col-xs-12">	
+		<div class="table-responsive">
+			<table class="table table-striped table-bordered table-hover">
+				<thead>
+					<tr>
+						<th>记录ID</th>
+						<th>客户编码</th>
+						<th>客户名称</th>
+						<th>变动金额</th>
+						<th>剩余金额</th>
+						<th>交易类型</th>
+						<th>交易状态</th>
+						<th>修改时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				
+				<tbody>
+						@foreach ($list as $a)
+						<tr>
+							<th>{{$a['id']}}</th>
+							<th>{{$a['custom_code']}}</th>
+							<th>{{$a['custom_name']}}</th>
+							<th> {{$a['prefix']==1?'+':'-'}} {{$a['amount']}}</th>
+							<td>{{$a['balance']}}</td>
+							<td>{{$a['buy_type']}}</td>
+							<td>{{$a['status']}}</td>
+							<td> {{date('Y/m/d H:i:s',$a['update_time'])}}</td>
+							<td></td>
+						</tr>  
+						@endforeach
+						<tr>
+							<td colspan="20" class="page">{{$list->render()}}</td>
+						</tr>
+						<tr>
+							<td colspan="20">总计 {{$list->total()}} 个记录</td>
+						</tr>
+				</tbody>
+				
+			</table>
+		</div>
+	</div>
+</div>
+@endsection

+ 24 - 0
resources/views/admin/custom_redpacket/add.blade.php

@@ -0,0 +1,24 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post" enctype="multipart/form-data">
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动ID <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="活动ID" maxlength="20" name="redpacket_id" value="{{$redpacketInfo['id']}}" disabled="" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动名称 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="活动名称" maxlength="20" name="redpacket_name" value="{{$redpacketInfo['name']}}" disabled="" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">发放对象</label>
+		<textarea class="form-control" name="custom_codes" rows="10" placeholder="需要发放的客户编码,多个使用换行" ></textarea>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection

+ 96 - 0
resources/views/admin/custom_redpacket/edit.blade.php

@@ -0,0 +1,96 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-12">
+		<label class="control-label">优惠券名称 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="优惠券名称" maxlength="20" name="name" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">优惠券类型 <span class="text-red">*</span></label>
+		<select class="form-control" required="required" name="rebate_type" id="rebate_type">
+			<option value="1" @if ( $oldData['rebate_type'] == '1' ) selected="selected" @endif>满减券</option>
+			<option value="2" @if ( $oldData['rebate_type'] == '2' ) selected="selected" @endif>折扣券</option>
+			<option value="3" @if ( $oldData['rebate_type'] == '3' ) selected="selected" @endif>赠品券</option>
+		</select>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">优惠力度 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<label class="control-label"> </label>
+			<div class="form-group col-sm-2">
+				<input  required="required" class="form-control" type="text" placeholder="满多少元" name="std_pay" value="{{$oldData['std_pay']}}" />
+			</div>
+			<div class="form-group col-sm-2">
+				<input  required="required" class="form-control" id="rebate" type="text" placeholder="减多少元" name="rebate" value="{{$oldData['rebate']}}" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">优惠券有效期 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-2">
+				<label class="control-label"><input type="radio" checked name="exp_type" value="1" @if ( $oldData['exp_type'] == 1 ) checked="" @endif > 领取后X天有效 </label>
+				<input class="form-control" type="number" placeholder="天数" name="exp_days" @if ( $oldData['exp_type'] == 1 ) value="{{intval($oldData['exp_time'])}}" @endif />
+			</div>
+			<div class="form-group col-sm-2">
+				<label class="control-label"><input type="radio" name="exp_type"  value="2" @if ( $oldData['exp_type'] == 2 )  checked="" @endif > 固定有效期</label>
+				<input class="form-control" id="rebate" type="date" placeholder="开始时间" name="start_time" @if ( $oldData['exp_type'] == 2 )  value="{{date('Y-m-d',$oldData['start_time'])}}" @endif />
+				<input class="form-control" id="rebate" type="date" placeholder="结束时间" name="end_time"  @if ( $oldData['exp_type'] == 2 ) value="{{date('Y-m-d',$oldData['end_time'])}}" @endif />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">发行数量 <span class="text-red">*</span> </label>
+		<input class="form-control" required="required" type="number" placeholder="发行数量" min="0" max="999999" name="issue_total" value="{{$oldData['issue_total']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">适用商品</label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-2">
+				<label class="control-label"><input type="radio" name="type_id" value="2" @if ( $oldData['type_id'] == 2 ) checked="" @endif> 全部商品范围</label>
+			</div>
+			<div class="form-group col-sm-2">
+				<label class="control-label"><input type="radio" name="type_id"  value="1" @if ( $oldData['type_id'] == 1 ) checked="" @endif > 指定商品范围</label>
+				<input class="form-control" type="file" placeholder="适用商品范围" maxlength="20" name="product_file" value="" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">适用客户</label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-2">
+				<label class="control-label"><input type="radio" name="is_appt" value="0" @if ( $oldData['is_appt'] == 0 ) checked="" @endif> 全部客户</label>
+			</div>
+			<div class="form-group col-sm-2">
+				<label class="control-label"><input type="radio" name="is_appt"  value="1" @if ( $oldData['is_appt'] == 1 ) checked="" @endif> 指定客户范围</label>
+				<input class="form-control" type="file" placeholder="适用客户范围" name="custom_file" value="" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input type="hidden" name="id" value="{{$oldData['id']}}" />
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection
+@section('javascript')
+<script>
+	$(function(){
+		// 类型变更
+		$('#rebate_type').change(function(){
+			// 获取值
+			var rebateType = $(this).val();
+			// 如果是满减
+			if( rebateType == 1 ) $('#rebate').attr('placeholder','减多少元');
+			// 如果是折扣
+			if( rebateType == 2 ) $('#rebate').attr('placeholder','打几折');
+			// 如果是赠品
+			if( rebateType == 3 ) $('#rebate').attr('placeholder','产品编码');
+		})
+	})
+</script>
+@endsection

+ 106 - 0
resources/views/admin/custom_redpacket/index.blade.php

@@ -0,0 +1,106 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<div class="page-header">
+	@if( check_auth('admin/custom_redpacket/add') )
+	<!-- <a href="{{url('admin/custom_redpacket/add')}}" class="btn btn-primary">新增</a> -->
+	@endif
+</div>
+<form action="" method="get" class="form-horizontal form-line" name="thisform" >
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="custom_code" value="{{request('custom_code','')}}" placeholder="请输入客户编码查询" />
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<select name="status" class="form-control">
+			<option value="" >领取状态</option>
+			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >待领取</option>
+			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >已领取</option>
+			<option value="2" @if (request('status') === '2' ) selected="selected" @endif >暂停</option>
+			<option value="3" @if (request('status') === '3' ) selected="selected" @endif >过期</option>
+			<option value="4" @if (request('status') === '4' ) selected="selected" @endif >作废</option>
+		</select>
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束时间查询" />
+	</div>
+	<div class="form-group col col-xs-4 col-md-2" style="margin-right: 2px;">
+		<button type="button" onclick="alter_from_attr({'method':'get','action':''})" class="btn btn-sm btn-primary" style="margin-right: 20px;"> 查询</button>
+		<a href="{{url('admin/custom_redpacket/index')}}" class="btn btn-sm btn-default" style="margin-right: 20px;" >重置</a>
+		@if( check_auth('admin/custom_redpacket/down_excel') )
+		<button type="button" onclick="alter_from_attr({'method':'get','action':`{{url('admin/custom_redpacket/down_excel')}}`})" class="btn btn-sm btn-primary"> 下载表格</button>
+		@endif
+	</div>
+</form>
+<div class="row">
+	<div class="col-xs-12">
+		<div class="table-responsive">
+			<table class="table table-striped table-bordered table-hover">
+				<thead>
+					<tr>
+						<th>活动ID</th>
+						<th>活动名称</th>
+						<th>客户编码</th>
+						<th>客户名称</th>
+						<th>红包金额</th>
+						<th>领取状态</th>
+						<th>领取时间</th>
+						<th>操作人员</th>
+						<th>修改时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['redpacket_id']}}</td>
+						<td> {{$a['redpacket_name']}}</td>
+						<td> {{$a['custom_code']}}</td>
+						<td> {{$a['custom_name']}}</td>
+						<td> {{$a['money']}}</td>
+						<td> 
+							@if ($a['status'] == 0) 待领取 @endif
+							@if ($a['status'] == 1) 已领取 @endif
+							@if ($a['status'] == 2) 暂停 @endif
+							@if ($a['status'] == 3) 过期 @endif
+							@if ($a['status'] == 4) 作废 @endif
+						</td>
+						<td>{{date('Y/m/d H:i:s',$a['start_time'])}} ~ {{date('Y/m/d H:i:s',$a['end_time'])}}</td>
+						<td>{{$a['admin_name']}}</td>
+						<td>{{date('Y/m/d H:i:s',$a['update_time'])}}</td>
+						<td>
+							@if( check_auth('admin/custom_redpacket/set_status') )
+								@if ( $a['status'] == 4 )
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/custom_redpacket/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
+										恢复
+									</a>
+								@endif
+								@if ( $a['status'] == 0 )
+									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/custom_redpacket/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'4']))}}">
+										作废
+									</a>
+								@endif
+							@endif
+						</td>
+					</tr>
+					@endforeach
+					<tr>
+						<td colspan="20" class="page">{{$list->render()}}</td>
+					</tr>
+					<tr>
+						<td colspan="20">总计 {{$list->total()}} 个记录</td>
+					</tr>
+				</tbody>
+
+			</table>
+		</div>
+	</div>
+</div>
+@endsection

+ 37 - 0
resources/views/admin/redpacket/add.blade.php

@@ -0,0 +1,37 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post" enctype="multipart/form-data">
+	<div class="form-group col-sm-6">
+		<label class="control-label">活动名称 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="优惠券名称" maxlength="20" name="name" value="" />
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">红包金额 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="红包金额" max="999.99" min="0.01"name="money" step="0.01" value="" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">领取时间 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-6">
+				<label class="control-label">开始时间 <span class="text-red">*</span></label>
+				<input  required="required" class="form-control" type="datetime-local" placeholder="开始时间" name="start_time" value="" />
+			</div>
+			<div class="form-group col-sm-6">
+			<label class="control-label">结束时间 <span class="text-red">*</span></label>
+				<input  required="required" class="form-control" type="datetime-local" placeholder="结束时间" name="end_time" value="" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动规则</label>
+		<textarea class="form-control" name="active_rule" rows="10" placeholder="请输入活动规则" maxlength="255" ></textarea>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection

+ 38 - 0
resources/views/admin/redpacket/edit.blade.php

@@ -0,0 +1,38 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<form class="post-form" action="" method="post">
+	<div class="form-group col-sm-6">
+		<label class="control-label">活动名称 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="优惠券名称" maxlength="20" name="name" value="{{$oldData['name']}}" />
+	</div>
+	<div class="form-group col-sm-6">
+		<label class="control-label">红包金额 <span class="text-red">*</span></label>
+		<input class="form-control" required="required" type="text" placeholder="红包金额" max="999.99" min="0.01"name="money" step="0.01" value="{{$oldData['money']}}" />
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">领取时间 <span class="text-red">*</span></label>
+		<div class="form-group col-sm-12">
+			<div class="form-group col-sm-6">
+				<label class="control-label">开始时间 <span class="text-red">*</span></label>
+				<input  required="required" class="form-control" type="datetime-local" placeholder="开始时间" name="start_time" value="{{date('Y-m-d H:i',$oldData['start_time'])}}" />
+			</div>
+			<div class="form-group col-sm-6">
+			<label class="control-label">结束时间 <span class="text-red">*</span></label>
+				<input  required="required" class="form-control" type="datetime-local" placeholder="结束时间" name="end_time" value="{{date('Y-m-d H:i',$oldData['end_time'])}}" />
+			</div>
+		</div>
+	</div>
+	<div class="form-group col-sm-12">
+		<label class="control-label">活动规则</label>
+		<textarea class="form-control" name="active_rule" rows="10" placeholder="请输入活动规则" maxlength="255" >{{$oldData['active_rule']}}</textarea>
+	</div>
+	<div class="form-group col-sm-12">
+		@csrf
+		<input type="hidden" name="id" value="{{$oldData['id']}}" />
+		<input id="send" type="submit" value="提交" class="btn btn-primary btn-block" />
+	</div>
+</form>
+@endsection

+ 95 - 0
resources/views/admin/redpacket/index.blade.php

@@ -0,0 +1,95 @@
+@extends('admin.public.base')
+@section('body_class')
+style="margin: 0 auto;width: 96%;padding: 30px 0px;"
+@endsection
+@section('content')
+<div class="page-header">
+	@if( check_auth('admin/redpacket/add') )
+	<a href="{{url('admin/redpacket/add')}}" class="btn btn-primary">新增</a>
+	@endif
+</div>
+<form action="" method="get" class="form-horizontal form-line">
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="name" value="{{request('name','')}}" placeholder="请输入活动名称查询" />
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<select name="status" class="form-control">
+			<option value="" >活动状态</option>
+			<option value="0" @if (request('status') === '0' ) selected="selected" @endif >启用</option>
+			<option value="1" @if (request('status') === '1' ) selected="selected" @endif >停用</option>
+		</select>
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="start_time" value="{{request('start_time','')}}" placeholder="请输入开始时间查询" />
+	</div>
+	<div class="form-group col col-md-1" style="margin-right: 2px;">
+		<input type="text" class="form-control" name="end_time" value="{{request('end_time','')}}" placeholder="请输入结束时间查询" />
+	</div>
+	<input type="submit" class="btn btn-sm btn-primary" value="查询"/>
+	<a href="{{url('admin/redpacket/index')}}" class="btn btn-sm btn-default" >重置</a>
+</form>
+<div class="row">
+	<div class="col-xs-12">
+		<div class="table-responsive">
+			<table class="table table-striped table-bordered table-hover">
+				<thead>
+					<tr>
+						<th>活动ID</th>
+						<th>红包名称</th>
+						<th>红包金额</th>
+						<th>活动状态</th>
+						<th>领取时间</th>
+						<th>修改时间</th>
+						<th>操作</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach ($list as $a)
+					<tr>
+						<td> {{$a['id']}}</td>
+						<td> {{$a['name']}}</td>
+						<td> ¥{{$a['money']}}元</td>
+						<td> {{$a['status']?'停用':'启用'}}</td>
+						<td> {{date('Y/m/d H:i',$a['start_time'])}} ~ {{date('Y/m/d H:i:s',$a['end_time'])}}</td>
+						<td> {{date('Y/m/d H:i',$a['update_time'])}}</td>
+						<td>
+							@if( check_auth('admin/custom_redpacket/add') )
+								<a href="{{url('admin/custom_redpacket/add?'.http_build_query(['redpacket_id'=>$a['id']]))}}" class="btn btn-primary btn-sm ">发放红包</a>
+							@endif
+							@if( check_auth('admin/redpacket/edit') )
+							<a class="btn btn-sm btn-warning" href="{{url('admin/redpacket/edit?'.http_build_query(['id'=>$a['id']]))}}">
+								编辑
+							</a>
+							@endif
+							@if( check_auth('admin/custom_redpacket/index') )
+							<a class="btn btn-sm btn-primary" href="{{url('admin/custom_redpacket/index?'.http_build_query(['redpacket_id'=>$a['id']]))}}" title="领用记录">
+								发放记录
+							</a>
+							@endif
+							@if( check_auth('admin/redpacket/set_status') )
+								@if ( $a['status'] )
+									<a class="delete btn btn-sm btn-success" data-url="{{url('admin/redpacket/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'0']))}}">
+										启用
+									</a>
+								@else
+									<a class="delete btn btn-sm btn-danger" data-url="{{url('admin/redpacket/set_status?'.http_build_query(['id'=>$a['id'],'status'=>'1']))}}">
+										停用
+									</a>
+								@endif
+							@endif
+						</td>
+					</tr>
+					@endforeach
+					<tr>
+						<td colspan="20" class="page">{{$list->render()}}</td>
+					</tr>
+					<tr>
+						<td colspan="20">总计 {{$list->total()}} 个活动</td>
+					</tr>
+				</tbody>
+
+			</table>
+		</div>
+	</div>
+</div>
+@endsection

+ 28 - 0
routes/web.php

@@ -540,4 +540,32 @@ Route::middleware('admin')->prefix('admin')->group(function(){
     // 拉新活动数据列表
     Route::any('recruitment_record/index',[App\Http\Controllers\Admin\RecruitmentRecord::class,'index']);
 
+
+    /* 红包活动 */
+    // 红包列表
+    Route::any('redpacket/index',[App\Http\Controllers\Admin\Redpacket::class,'index']);
+    // 新增
+    Route::any('redpacket/add',[App\Http\Controllers\Admin\Redpacket::class,'add']);
+    // 编辑
+    Route::any('redpacket/edit',[App\Http\Controllers\Admin\Redpacket::class,'edit']);
+    // 状态
+    Route::any('redpacket/set_status',[App\Http\Controllers\Admin\Redpacket::class,'set_status']);
+
+    /* 客户红包记录 */
+    // 红包列表
+    Route::any('custom_redpacket/index',[App\Http\Controllers\Admin\CustomRedpacket::class,'index']);
+    // 新增
+    Route::any('custom_redpacket/add',[App\Http\Controllers\Admin\CustomRedpacket::class,'add']);
+    // 编辑
+    Route::any('custom_redpacket/edit',[App\Http\Controllers\Admin\CustomRedpacket::class,'edit']);
+    // 状态
+    Route::any('custom_redpacket/set_status',[App\Http\Controllers\Admin\CustomRedpacket::class,'set_status']);
+    // 状态
+    Route::any('custom_redpacket/down_excel',[App\Http\Controllers\Admin\CustomRedpacket::class,'down_excel']);
+
+    /* 余额记录 */
+    // 余额
+    Route::any('amount_record/index',[App\Http\Controllers\Admin\AmountRecord::class,'index']);
+    // 状态
+    Route::any('amount_record/down_excel',[App\Http\Controllers\Admin\AmountRecord::class,'down_excel']);
 });