| 
					
				 | 
			
			
				@@ -3,6 +3,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 namespace app\mainapp\controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use app\common\model\ResumeInvite; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use app\common\model\UserGetmoneyLog as UserGetmoneyLogModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use app\common\model\UserGetmoneyLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use app\common\model\UserWill; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use app\common\service\IntegralService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use app\mainapp\BaseController; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -26,6 +28,7 @@ use app\common\model\ArticleCollect as ArticleCollectModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use echowx\WxProgram; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use echowx\WxPay; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use payment\wechat\WechatTransfers; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class My extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -428,7 +431,7 @@ class My extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $field       = input('field/s'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $value       = input('value'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $field_array = ['emp_time', 'com_cate','work_place']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $field_array = ['emp_time', 'com_cate', 'work_place']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (in_array($field, $field_array)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $value = json_decode($value, true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -449,7 +452,7 @@ class My extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             $user->save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $integralService = new IntegralService(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $integralService->add($userid,IntegralService::IMPROVERESUME); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $integralService->add($userid, IntegralService::IMPROVERESUME); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         page_result(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -544,38 +547,137 @@ class My extends BaseController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $userid = input('userid/d'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $check = UserIntegralModel::where('createtime','>=',strtotime(date('Y-m-d'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ->where('createtime','<=',strtotime(date('Y-m-d 23:59:59'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ->where('userid',$userid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            ->where('itype',9) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $check = UserIntegralModel::where('createtime', '>=', strtotime(date('Y-m-d'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('createtime', '<=', strtotime(date('Y-m-d 23:59:59'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('userid', $userid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('itype', 9) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!empty($check)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             page_result(1, "今日已签到"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $integralService = new IntegralService(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        $integralService->add($userid,IntegralService::SINGIN,9); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $integralService->add($userid, IntegralService::SINGIN, 9); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         page_result(0, ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     public function task() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         $userid = input('userid/d'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         $param = UserParamModel::field(['improveresume','certification','entry','signin','sharejob','sharejobnum','taskimage'])->where(1)->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         $share_num = UserIntegralModel::where('createtime','>=',strtotime(date('Y-m-d'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->where('createtime','<=',strtotime(date('Y-m-d 23:59:59'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->where('userid',$userid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->where('itype',10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         $check = UserIntegralModel::where('createtime','>=',strtotime(date('Y-m-d'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->where('createtime','<=',strtotime(date('Y-m-d 23:59:59'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->where('userid',$userid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->where('itype',9) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             ->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         $is_signin = empty($check) ? 2 : 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         page_result(0, "",['tasklist'=>$param,'share_num'=>$share_num,'is_signin'=>$is_signin]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function task() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $userid = input('userid/d'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $param     = UserParamModel::field(['improveresume', 'certification', 'entry', 'signin', 'sharejob', 'sharejobnum', 'taskimage'])->where(1)->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $share_num = UserIntegralModel::where('createtime', '>=', strtotime(date('Y-m-d'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('createtime', '<=', strtotime(date('Y-m-d 23:59:59'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('userid', $userid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('itype', 10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $check     = UserIntegralModel::where('createtime', '>=', strtotime(date('Y-m-d'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('createtime', '<=', strtotime(date('Y-m-d 23:59:59'))) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('userid', $userid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->where('itype', 9) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $is_signin = empty($check) ? 2 : 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        page_result(0, "", ['tasklist' => $param, 'share_num' => $share_num, 'is_signin' => $is_signin]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function getmoneylist() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $ppage  = input('ppage/d', 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $psize  = input('psize/d', 20); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $userid = input('userid/d', 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($userid != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $map[] = ['userid', '=', $userid]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $plist = UserGetmoneyLogModel::where($map)->order(['id' => 'desc'])->page($ppage)->limit($psize)->select()->append(['itype_text', 'status_text']); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        page_result(0, "", [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            'plist'   => $plist, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function getmoneyparam() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $param = UserParamModel::where(1)->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (empty($param)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $param['getmoney'] = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        page_result(0, "", ['getmoney' => $param['getmoney']]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function cash() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $index  = input('index/d', 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $userid = input('userid/d', 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取配置参数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $param = UserParamModel::where(1)->find(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (empty($param) || empty($param['getmoney'])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            page_result(1, "参数未配置"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (empty($param['getmoney'][$index])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            page_result(1, "参数错误"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $cash = $param['getmoney'][$index]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //满足提现条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $user = UserModel::findOrEmpty($userid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($user['integral'] < ($cash['money'] * $param['inttomoney'])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            page_result(1, "积分不足"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $where = [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ['userid', '=', $userid], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ['money', '=', $cash['money']], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($cash['type'] == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $where = ['createtime', '>=', strtotime(date('Y-m-01'))]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $cash_count = UserGetmoneyLog::where($where)->count(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if ($cash_count >= $cash['num']) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            page_result(1, "超过次数限制"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //提现 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $batch_name   = '晋江人力小程序用户提现';//转账的名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $out_trade_no = 'jfhd' . getUniId();//单号 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $openid       = UserAuthsModel::where('userid',$userid)->where('identitytype','weixin')->value('identifier');//用户openid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $detail       = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $transfers    = new WechatTransfers(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $detail[]     = $transfers->getDetailList($out_trade_no, $cash['money'], $batch_name, $openid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $res          = $transfers->transfers($batch_name, $detail); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        halt($res); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!empty($res['batch_id'])) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $point = $cash['money'] * $param['inttomoney']; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            UserGetmoneyLog::create([ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'userid'       => $userid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'out_trade_no' => $out_trade_no, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'money'        => $cash['money'], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'integral'     => $point, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'remark'       => '小程序用户提现', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'createtime'   => time(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $integral = new UserIntegralModel; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $integral->save([ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'userid'      => $userid, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'title'       => "用户提现", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'intvalue'    => $point, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'intmoney'    => 0.00, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'onlycontent' => "", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'remark'      => "积分提现活动", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'itype'       => 3, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'status'      => 2, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'createtime'  => time(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'yeartime'    => date("Y"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                'monthtime'   => date("Ym"), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            ]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $user->integral -= $point; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $user->save(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        page_result(0, "提现成功",$user); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |