Commit 5d47f0d5 authored by clone's avatar clone

Merge branch '0308-3.1.2' into test

# Conflicts: # application/index/controller/Finance.php # public/app/dist/index.html # public/app/dist/static/css/app.114859684c94a19f75437a9f4ca158c8.css # public/app/dist/static/css/app.fb0495c45d8e8f4a215b24c757e3a74d.css # public/app/dist/static/css/app.fb80942a8f4629b9d9ca5ae8252cd001.css # public/app/dist/static/js/app.2cb278bd36009512e8d4.js # public/resource/js/getCollection.js
parents b4a85c8e 3dabe940
<?php
namespace app\api\controller;
use app\api\extend\Basic;
use app\api\service\AccountBalanceService;
use think\Request;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2019/3/13
* Time: 10:17
*/
class AccountBalance extends Basic
{
private $s_account_balance;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->s_account_balance = new AccountBalanceService();
}
/**
* 收益明细
* @return \think\Response
*/
public function userAccountBalanceList()
{
$params = $this->params;
/* $params = array(
"create_time_start" => '2019-03-14 11:03:10',
"create_time_end" => '2019-03-15 11:03:10',
"user_phone" => '6471',
"user_id" => '111',
);*/
if (empty($params["user_id"])) {
return $this->response("101", "请求参数错误");
}
$data = $this->s_account_balance->getBalanceList($params);
if (count($data) <= 0) {
return $this->response("200", "null");
}
return $this->response("200", "success!", $data);
}
/**
* 账户余额
* @return \think\Response
*/
public function totalAccount()
{
$params = $this->params;
/*$params = array(
"user_id" => 4
);*/
if (empty($params["user_id"])) {
return $this->response("101", "请求参数错误");
}
$total = $this->s_account_balance->getAccountTotal($params["user_id"]);
if ($total <= 0) {
$total = 0;
}
return $this->response("200", "success", ["total" => $total]);
}
/**
* 申请提现
* @return \think\Response
*/
public function applyForWithdraw()
{
$params = $this->params;
/*$params = array(
"user_id" => 4,
"money" => 11,
"user_phone"=> "11231",
"user_name" => "12312"
);*/
if (empty($params["user_id"]) || empty($params["money"]) || empty($params["user_phone"])) {
return $this->response("101", "请求参数错误");
}
$user_id = $params["user_id"];
$user_phone = $params["user_phone"];
$money = $params["money"];
$user_name = $params["user_name"];
if ($money < 30) {
return $this->response("101", "提现金额不能小于30");
}
$total = $this->s_account_balance->getAccountTotal($user_id);
if($money > $total){
return $this->response("101", "账户余额不足,请刷新后再提交!");
}
$result = $this->s_account_balance->addCheck($user_id, $user_phone, $money, $user_name);
if ($result > 0) {
return $this->response("200", "申请已提交,等待后台审核");
}
return $this->response("101", "申请提现异常");
}
}
\ No newline at end of file
<?php
namespace app\api\controller;
use app\api\extend\Basic;
use app\api\service\ActivityService;
use think\Request;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 9:46
*/
class Activity extends Basic
{
private $activityService;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->activityService = new ActivityService();
}
}
\ No newline at end of file
...@@ -348,6 +348,7 @@ class AppointmentTime extends Basic ...@@ -348,6 +348,7 @@ class AppointmentTime extends Basic
$where['user_id'] = $this->userId; $where['user_id'] = $this->userId;
// $where['user_id'] = 122; // $where['user_id'] = 122;
$where['status'] = 0; $where['status'] = 0;
$where['type'] = 0;
$id = $m_push->getListByWhere('id,operation_id,message', $where, 1, 1); $id = $m_push->getListByWhere('id,operation_id,message', $where, 1, 1);
......
<?php
namespace app\api\controller;
use app\api\extend\Basic;
use app\model\CActivity;
use app\model\CCoupon;
use think\Request;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 10:17
*/
class Coupon extends Basic{
private $m_coupon;
private $m_activity;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_coupon = new CCoupon();
$this->m_activity = new CActivity();
}
/**
* @return \think\Response
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function getHomeCoupon()
{
if (empty($this->userId)) {
return $this->response(101, '请登录');
}
$data = [];
$where['user_id'] = $this->userId;
// $where['user_id'] = 1;
$where['first_show'] = 0;
$coupon_data = $this->m_coupon->getCouponColumn('id,activity_id', $where);
if (!empty($coupon_data)) {
$activity_id = array_unique(array_values($coupon_data));
$coupon_id = array_keys($coupon_data);
$activity_where['id'] = ['in', $activity_id];
$data = $this->m_activity->getActivity('title,money,return_type,return_action', $activity_where);
foreach ($data as $k=>$v) {
switch ($v['return_action']) {
case 1:
$subheading = '成功注册并登陆的奖励';
break;
case 2:
$subheading = '在同联商业成交的奖励';
break;
default :
$subheading = 'APP - 我的现金红包中查看';
}
$data[$k]['title'] = $v['title'];
$data[$k]['subheading'] = $subheading;
$data[$k]['content'] = '返现红包';
$data[$k]['money'] = (int)$v['money'] . '';
}
$this->m_coupon->updateData(['first_show'=>1], ['id'=>['in',$coupon_id]]);
}
return $this->response(200, '', $data);
}
/**
* 返现红包列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function couponList()
{
$page_no = empty($this->params['page_no']) ? 1 : $this->params['page_no'];
$page_size = empty($this->params['page_size']) ? 15 : $this->params['page_size'];
if (empty($this->userId)) {
return $this->response(101, '参数错误');
}
$data = [];
$where['user_id'] = $this->userId;
// $where['user_id'] = 1;
$field = 'rule_no,activity_id,status,create_time';
$list = $this->m_coupon->getList($page_no, $page_size, 'id desc', $field, $where);
$field_activity = 'title,money,use_period,activity_rule';
foreach ($list as $k => $v) {
$data[$k]['id'] = $v['rule_no'];
$data[$k]['status'] = $v['status'];
$activity_data = $this->m_activity->getFind($field_activity, ['id'=>$v['activity_id']]);
$create_time = strtotime($v['create_time']);
if ($activity_data['use_period'] != -1) {
$validity = $create_time + $activity_data['use_period'] * 86400;
$data[$k]['validity'] = date('Y.m.d', $create_time).'-'.date('Y.m.d', $validity);
} else {
$data[$k]['validity'] = '不限';
}
$data[$k]['money'] = $activity_data['money'];
$data[$k]['title'] = $activity_data['title'];
$data[$k]['activity_rule'] = $activity_data['activity_rule'];
}
return $this->response(200, '', $data);
}
}
\ No newline at end of file
...@@ -322,7 +322,7 @@ class Member extends Basic ...@@ -322,7 +322,7 @@ class Member extends Basic
$params = $this->params; $params = $this->params;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$result = $this->user->field('id,user_nick,user_phone,registration_time as create_time,user_pic,other_pic') $result = $this->user->field('id,user_nick,user_phone,registration_time as create_time,user_pic,other_pic,first_login_time')
->where('referrer_id',$id) ->where('referrer_id',$id)
->where('status',0) ->where('status',0)
->order('create_time desc') ->order('create_time desc')
...@@ -338,7 +338,7 @@ class Member extends Basic ...@@ -338,7 +338,7 @@ class Member extends Basic
$data_arr[$k]['user_pic'] = AGENTHEADERIMGURL . 'icon_head.png'; $data_arr[$k]['user_pic'] = AGENTHEADERIMGURL . 'icon_head.png';
} }
$data_arr[$k]['user_phone'] = hide_customer_phone($arr['user_phone']); $data_arr[$k]['user_phone'] = hide_customer_phone($arr['user_phone']);
$data_arr[$k]['create_time'] = date('Y-m-d', strtotime($arr['create_time'])); $data_arr[$k]['create_time'] = $v['first_login_time'] ? date('Y-m-d', strtotime($v['first_login_time'])) : '';//改首次登陆时间
} }
$data['data'] = $data_arr; $data['data'] = $data_arr;
$data['status'] = 200; $data['status'] = 200;
......
<?php
namespace app\api\service;
use app\model\UAccountBalance;
use app\model\UAccountCheck;
use app\model\Users;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2019-03-13
* Time: 14:05:36
*/
class AccountBalanceService{
private $m_account_balance;
public function __construct()
{
$this->m_account_balance = new UAccountBalance();
}
public function addUserBalance($money,$user_id,$source_type,$source_id,$operation_id){
if(!$user_id or !$money){
return false;
}
$user_info = $this->getUserInfo($user_id);
$insert["money"] = $money;//金额
$insert["user_id"] = $user_id;//用户id
$insert["user_phone"] = $user_info[0]['user_phone'];//用户手机号
$insert["user_name"] = $user_info[0]['user_name'];//用户手机号
$insert["source_type"] = $source_type;//来源类型 0:优惠券
$insert["source_id"] = $source_id;//来源id,type 0 为优惠券id
$insert["operation_id"] = $operation_id;//操作人id
$this->m_account_balance->addBalance($insert);
}
//todo 获取用户账户余额
public function getUserBalance(){
}
//todo 后台账户明细表
/**
* 账户明细列表
* @param $params
* @return mixed
*/
public function getBalanceList($params){
$res = $this->m_account_balance->getBalanceList($params);
return $res;
}
public function getBalanceCount($params){
$balanceCount = $this->m_account_balance->getBalanceCount($params);
$accountCheckModel = new UAccountCheck();
$checkCount = $accountCheckModel->getCheckCount($params);
return $balanceCount + $checkCount ;
}
/**
* 获取客户信息
* @param $user_id
* @return bool|false|\PDOStatement|string|\think\Collection
*/
public function getUserInfo($user_id)
{
$m_user = new Users();
$field_referrer = 'id,user_phone,user_name';
$referrer_res = $m_user->getUserByWhere([ "id" => $user_id ], $field_referrer);
if (count($referrer_res) <= 0)
return false;
return $referrer_res;
}
public function getAccountTotal($user_id){
$balanceTotal = $this->m_account_balance->getBalanceTotal($user_id);
$accountCheckModel = new UAccountCheck();
$checkTotal = $accountCheckModel->getCheckTotal($user_id);
return $balanceTotal - $checkTotal ;
}
public function addCheck($user_id,$user_phone,$money,$user_name){
$arr = array(
"user_id" => $user_id,
"user_phone" => $user_phone,
"money" => $money,
"status" => 0,
"user_name" => $user_name,
"create_time" => date("Y-m-d H:i:s",time()),
"update_time" => date("Y-m-d H:i:s",time()),
);
$accountCheckModel = new UAccountCheck();
return $accountCheckModel->addCheck($arr);
}
public function check($id,$operator_id,$operator_name,$transfer_img,$status){
$arr = array(
"operator_id" => $operator_id,
"operator_name" => $operator_name,
"status" => $status,
"transfer_img" => $transfer_img,
"transfer_time" => date("Y-m-d H:i:s",time()),
"update_time" => date("Y-m-d H:i:s",time()),
);
$accountCheckModel = new UAccountCheck();
return $accountCheckModel->updateCheck($id,$arr);
}
}
\ No newline at end of file
<?php
namespace app\api\service;
use app\model\CActivity;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 10:15
*/
class ActivityService
{
private $activityModel;
public function __construct()
{
$this->activityModel = new CActivity();
}
public function createActivity($id, $title, $money, $return_action, $activity_start_time,
$activity_end_time, $use_period, $total, $available, $activity_rule)
{
$arr = $this->activityBin($id, $title, $money, $return_action, $activity_start_time,
$activity_end_time, $use_period, $total, $available, $activity_rule);
$install_id = 0;
if($id > 0){
$install_id = $this->activityModel->editorActivity($id,$arr);
}else{
$install_id = $this->activityModel->addActivity($arr);
}
return $install_id;
}
private function activityBin($id, $title, $money, $return_action, $activity_start_time,
$activity_end_time, $use_period, $total, $available, $activity_rule)
{
if ($id == 0) {
$arr["create_time"] = date("Y-m-d H:i:s", time());
}
if (!empty($title)) {
$arr["title"] = $title;
}
if (!empty($money)) {
$arr["money"] = $money;
}
if (isset($return_action)) {
$arr["return_action"] = $return_action;
}
if (!empty($activity_start_time)) {
$arr["activity_start_time"] = date("Y-m-d H:i:s", $activity_start_time);
}
if (!empty($activity_end_time)) {
$arr["activity_end_time"] = date("Y-m-d H:i:s", $activity_end_time);
}
if (!empty($use_period)) {
$arr["use_period"] = $use_period;
}
if (!empty($total)) {
$arr["total"] = $total;
}
if (!empty($available)) {
$arr["available"] = $available;
}
if (!empty($activity_rule)) {
$arr["activity_rule"] = $activity_rule;
}
$arr["update_time"] = date("Y-m-d H:i:s", time());
//新增的时候才判断是否开始活动
if ($activity_start_time > time() && $id == 0) {
$arr["status"] = 5;
} else {
$arr["status"] = 0;
}
return $arr;
}
}
<?php
namespace app\api\service;
use app\model\CCoupon;
use app\model\OPayLogModel;
use app\model\Users;
/**
* 核销优惠券
* Created by PhpStorm.
* User: zhuwei
* Date: 2019/3/12
* Time: 2:39 PM
*/
class ConvertCouponService
{
private $m_coupon;
private $m_user;
private $m_pay_log;
private $s_account_balance;
function __construct()
{
$this->m_coupon = new CCoupon();
$this->m_user = new Users();
$this->m_pay_log = new OPayLogModel();
$this->s_account_balance = new AccountBalanceService();
}
public function adddata()
{
//新增数据
$insert["activity_id"] = 1;//活动id
$insert["rule_no"] = 'shdkjashcjkahskdjkakjcbajksdhfjkahsdjkcajksdhcfjkasdhjk';//优惠券编号,根据规则生成加密编号
$insert["user_id"] = 88;//用户id
$insert["referrer_id"] = 66;//邀请人id
$insert["report_id"] = 12;//报备id
$insert["bargain_id"] = 12;//成交报告id
$insert["order_id"] = 12;//订单id
$insert["use_time"] = '';//使用日期
$insert["status"] = 0;//0正常 1已使用 2过期
$insert["first_show"] = 1;//0未展示1已展示
$res = $this->m_coupon->addCoupon($insert);//int(1)
}
/**
* 核销优惠券
* @param $user_id
* @param $report_id
* @param $bargain_id
* @param $order_id
* @return bool
*/
public function convertCoupon($user_id,$report_id,$bargain_id,$order_id){
if(!$user_id or !$report_id or !$bargain_id or !$order_id){
return false;
}
big_log('=============客户DI:'.$user_id.' START=================');
#验证 同一订单是否存在核销记录
$verification_order = $this->verificationOrderId($user_id,$order_id);
if(!$verification_order){
return false;
}
#验证 客户首次登录时间 是否在 收意向金时间 之间是否大于48小时
$verification_res = $this->verificationFirstLoginTime($user_id);
if(!$verification_res){
return false;
}
#根据$user_id 取出 当前客户的 0首次登陆 1邀请登陆 券
$coupon_list = $this->getCoupon($user_id,'');
big_log('1'.json_encode($coupon_list));
if(!$coupon_list){
return false;
}
#去除已经过期的优惠券
$coupon_list = $this->filterExpireData($coupon_list);
big_log('2'.json_encode($coupon_list));
#存在未过期 券数等于1直接核销
$coupon_list_count = count($coupon_list);
if($coupon_list_count == 0){
return false;
}elseif($coupon_list_count > 1){
//券不止一张选取金额最大的核销
$max_coupon = $this->getMaxCoupon($coupon_list);
big_log('3'.json_encode($coupon_list));
$coupon_list = [];
$coupon_list[] = $max_coupon;
big_log('4'.json_encode($coupon_list));
}
big_log('5'.json_encode($coupon_list));
big_log('6'.json_encode($coupon_list[0]['id']));
#修改券状态为已使用
$this->m_coupon->updateUseStatus($coupon_list[0]['id'],1,$report_id,$bargain_id,$order_id,date("Y-m-d H:i:s", time()));
#将活动奖励金额写入账户余额
$this->s_account_balance->addUserBalance($coupon_list[0]['money'],$user_id,0,$coupon_list[0]['id'],0);
#查询当前客户的是否有邀请人
$invite_user = $this->getUserInviter($user_id);
if(!$invite_user){
return false;
}
#是客户 根据邀请人user_id 和被邀请人user_id 取出 2邀请成交 券
$invite_user_coupon_list = $this->getCoupon($user_id,$invite_user);
if(!$invite_user_coupon_list){
return false;
}
#去除已经过期的优惠券
$invite_user_coupon_list = $this->filterExpireData($invite_user_coupon_list);
#存在未过期
$invite_user_coupon_list_count = count($invite_user_coupon_list);
if($invite_user_coupon_list_count == 0){
return false;
}elseif($invite_user_coupon_list_count == 1){
//券不止一张选取金额最大的核销
$max_invite_user_coupon = $this->getMaxCoupon($invite_user_coupon_list);
$invite_user_coupon_list = [];
$invite_user_coupon_list[] = $max_invite_user_coupon;
}
// 修改券状态为已使用
$this->m_coupon->updateUseStatus($invite_user_coupon_list[0]['id'],1,$report_id,$bargain_id,$order_id,date("Y-m-d H:i:s", time()));
// 将活动奖励金额写入账户余额 $coupon_list[0]['money']
$this->s_account_balance->addUserBalance($invite_user_coupon_list[0]['money'],$invite_user,0,$invite_user_coupon_list[0]['id'],0);
return true;
}
/**
* 获取最大优惠券
* @return mixed
*/
public function getMaxCoupon($coupon_list){
$field ='money';
$temp = [];
foreach ($coupon_list as $k=>$v){
$temp[]=$v[$field];
}
$max_money = max($temp);
foreach ($coupon_list as $k=>$v){
if($v[$field] == $max_money){
return $coupon_list[$k];
}
}
}
/**
* 去除已经过期的优惠券,并修改状态为已过期
* @param $coupon_list
* @return mixed
*/
public function filterExpireData($coupon_list){
// 循环查看是否过期
foreach ($coupon_list as $k => $v) {
if($v['use_period']<0){
continue;
}
#发券日期大于最后使用日期
if( $v['create_time'] > date("Y-m-d H:i:s", strtotime("+{$v['use_period']} day",strtotime($v['create_time'])))){
big_log('优惠券已经过期');
$this->m_coupon->updateStatus($v['id'],2);
unset($coupon_list[$k]);
continue;
}
}
return $coupon_list;
}
/**
* 获取优惠券
* @param $user_id
* @param $referrer_id
* @return false|\PDOStatement|string|\think\Collection
*/
public function getCoupon($user_id,$referrer_id){
$field = 'a.id,a.activity_id,a.create_time,b.money,b.use_period';
if($referrer_id){
$params['a.user_id'] = $referrer_id;
$params['a.invitee_id'] = $user_id;
$params['b.return_action'] = 2;
}else{
$params['a.user_id'] = $user_id;
// $params['b.return_action'] = array("in","0,1");
$params['b.return_action'] = 0;
}
$params['a.status'] = 0;
return $this->m_coupon->getCouponJoinActivity($field,$params);
}
/**
* 获取客户信息
* @param $user_id
* @return bool|false|\PDOStatement|string|\think\Collection
*/
public function getUserInfo($user_id)
{
$field_referrer = 'id,referrer_id,referrer_source,first_login_time';
$referrer_res = $this->m_user->getUserByWhere([ "id" => $user_id ], $field_referrer);
if (count($referrer_res) <= 0)
return false;
return $referrer_res;
}
/**
* 获取客户邀请人[必须是客户]
* @param $user_id
* @return bool
*/
public function getUserInviter($user_id)
{
//查找邀请人的信息
$referrer_res = $this->getUserInfo($user_id);
if (!$referrer_res){
big_log('未查询到邀请人');
return false;
}
// 存在邀请人则判断是否是客户
if ($referrer_res[0]['referrer_source'] == 20) {
big_log('客户邀请人为经纪人');
return false;
}
return $referrer_res[0]['referrer_id'];
}
/**
* 验证 客户首次登录时间 是否在 收意向金时间 之间是否大于48小时
* @param $user_id
* @return bool
*/
public function verificationFirstLoginTime($user_id){
$user_info = $this->getUserInfo($user_id);
if (!$user_info){
big_log('客户不存在!');
return false;
}
$first_login_time = $user_info[0]['first_login_time'];
if (!$first_login_time) {
big_log('客户首次登录时间为空');
return false;
}
$params['user_id'] = $user_id;
$params['type'] = 10;
$pay_log = $this->m_pay_log->getPayLogByUserId('a.create_time',$params);
$pay_log_time = $pay_log['create_time'];
if (!$pay_log_time){
big_log('客户不存在收意向金');
return false;
}
$pay_hour = (strtotime($pay_log_time)-strtotime($first_login_time))/3600;
if($pay_hour < 48 ){
big_log('客户首次登录时间 和 收意向金时间 小于48小时');
return false;
}
return true;
}
/**
* 判断同一订单是否存在核销记录
* @param $user_id
* @param $order_id
* @return bool
*/
public function verificationOrderId($user_id,$order_id){
$field = 'a.id';
$params['a.user_id'] = $user_id;
$params['a.order_id'] = $order_id;
if($this->m_coupon->getCouponJoinActivity($field,$params)){
return false;
}
return true;
}
}
\ No newline at end of file
<?php
namespace app\api\service;
use app\api\untils\CouponNoEncodingUntils;
use app\extra\RedisExt;
use app\model\CActivity;
use app\model\CCoupon;
use app\model\Users;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 10:18
*/
class CouponService{
private $m_coupon;
private $m_user;
private $m_activity;
private $redis_;
public function __construct()
{
$this->m_coupon = new CCoupon();
$this->m_user = new Users();
$this->m_activity = new CActivity();
}
/**
* 发券
*
* @param int $user_id
* @param int $invitee_id
* @param int $type
* @param int $first_show
* @return mixed
* @throws \think\exception\PDOException
*/
public function sendCoupon(int $user_id, int $invitee_id,int $type, $first_show = 0) {
$result['status'] = 'successful';
$result['msg'] = '发券成功';
$result['data'] = [];
$this->redis_ = RedisExt::getRedis();
$key = 'send_coupon_'.$user_id;
if ($this->redis_->get($key)) {
$result['status'] = 'fail';
$result['msg'] = '正在发券中,请稍等...';
return $result;
} else {
$this->redis_->set($key, $user_id, 3);
}
try {
$user_data = $this->m_user->getUserById('id', $user_id, ['status'=>0]);
if (empty($user_data['id'])) {
$result['status'] = 'fail';
$result['msg'] = '该用户不存在';
return $result;
}
$activity_data = $this->checkUserCoupon($user_id, $type, $invitee_id);
if (empty($activity_data)) {
$result['status'] = 'fail';
$result['msg'] = '没有可参加的活动';
return $result;
}
$save_data = [];
$save_data['user_id'] = $user_id;
if ($invitee_id) {
$save_data['invitee_id'] = $invitee_id;
}
$save_data['status'] = 0;
$save_data['first_show'] = $first_show;
$save_data['create_time'] = date('Y-m-d H:i:s');
$this->m_coupon->startTrans();
$coupon_untils = new CouponNoEncodingUntils();
foreach ($activity_data as $k=>$v) {
$save_data['activity_id'] = $v['id'];
$insert_id = $this->m_coupon->insertData($save_data);
if ($insert_id) {
$rule_no = $coupon_untils->encryptionCouponNo($insert_id);
$this->m_coupon->updateData(['rule_no'=>$rule_no], ['id'=>$insert_id]);
$this->m_activity->plusGetNumber($v['id']); //增加用户领取数量
}
}
$this->redis_->del($key);
$this->m_coupon->commitTrans();
}catch (\Exception $e) {
$this->m_coupon->rollBackTrans();
$result['status'] = 'fail';
$result['msg'] = '发券失败';
}
return $result;
}
/**
* 查询奖励动作
*
* @param string $field
* @param $return_action @奖励动作 0首次登陆 1邀请登陆 2邀请成交
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectActivity($field = 'id', $return_action) {
if (is_array($return_action)) {
$where['return_action'] = ['in', $return_action];
} else {
$where['return_action'] = $return_action;
}
$where['status'] = 0; //0正常 1手动停止 2数量为空 3时间过期 4删除 5未开始
$where['activity_start_time'] = ['<>', '0000-00-00 00:00:00'];
$where['activity_end_time'] = ['<>', '0000-00-00 00:00:00'];
$data = $this->m_activity->getActivity($field, $where);
return $data;
}
/**
* 检查可以参加的活动
*
* @param int $user_id
* @param int $type
* @param $invitee_id
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function checkUserCoupon(int $user_id, int $type, $invitee_id)
{
$return_activity = [];
$time = time();
$field = 'id,return_type,money,activity_start_time,activity_end_time,use_period,total,available,total';
$field .= ',available,get_number,create_time';
$activity_data = $this->selectActivity($field, $type);
$count_where['user_id'] = $user_id;
foreach ($activity_data as $k=>$v) {
if ($v['total'] != -1) {
if ($v['total'] - $v['get_number'] <= 0 ) {
continue;
}
}
if ($v['available'] != -1) {
if ($type == 0) {
if ($invitee_id) {
$count_where['invitee_id'] = $invitee_id;
}
$count_where['activity_id'] = $v['id'];
$num = $this->m_coupon->getCount($count_where); //是否邀请过该客户
if ($num > 0) {
continue;
}
}
$where['user_id'] = $user_id;
$where['activity_id'] = $v['id'];
$where['status'] = ['<>',2];
$num = $this->m_coupon->getCount($where);
if ($num > $v['available']) {
continue;
}
}
if (strtotime($v['activity_start_time']) < $time && strtotime($v['activity_end_time']) > $time) {
$return_activity[] = $v;
}
}
return $return_activity;
}
}
\ No newline at end of file
...@@ -33,7 +33,7 @@ class PushClientService ...@@ -33,7 +33,7 @@ class PushClientService
* @param int $operation_id * @param int $operation_id
* @return bool * @return bool
*/ */
public function record(int $report_id, int $order_id, int $type, $message,int $operation_id) public function record(int $report_id, int $order_id, int $type, $message,int $operation_id, $addressee_id = 0)
{ {
$order = new OrderModel(); $order = new OrderModel();
...@@ -42,6 +42,10 @@ class PushClientService ...@@ -42,6 +42,10 @@ class PushClientService
$report = new OReportModel(); $report = new OReportModel();
$user_id = $report->getFieldValue('user_id', ['id'=>$report_id]); $user_id = $report->getFieldValue('user_id', ['id'=>$report_id]);
if (empty($user_id)) {
$user_id = $addressee_id;
}
if (empty($message)) { if (empty($message)) {
$m_agent = new AAgents(); $m_agent = new AAgents();
$message = $m_agent->getAgentsById($operation_id, 'name'); $message = $m_agent->getAgentsById($operation_id, 'name');
...@@ -70,6 +74,16 @@ class PushClientService ...@@ -70,6 +74,16 @@ class PushClientService
$type = 'evaluate'; $type = 'evaluate';
$content = '同联商业邀请您评价经纪人'.$v['message'].'对商铺的带看服务'; $content = '同联商业邀请您评价经纪人'.$v['message'].'对商铺的带看服务';
break; break;
case 1:
$title = "新人专享返现红包";
$type = 'first_login';
$content = $v['message'];
break;
case 2:
$title = "邀请成交返现红包";
$type = 'referrer_coupon';
$content = $v['message'];
break;
} }
$this->pushAgentAllDeviceId($v['operation_id'], $title, $content, $type, $v['user_id'], $is_forbidden, $v['house_id'], $v['order_id'], $v['message']); $this->pushAgentAllDeviceId($v['operation_id'], $title, $content, $type, $v['user_id'], $is_forbidden, $v['house_id'], $v['order_id'], $v['message']);
......
...@@ -123,6 +123,20 @@ class RegisterService ...@@ -123,6 +123,20 @@ class RegisterService
$jwt_data['userNick'] = $user_nick; $jwt_data['userNick'] = $user_nick;
$jwt_data['phone'] = $phone; $jwt_data['phone'] = $phone;
$coupon_service = new CouponService();
$service = new PushClientService();
if (!empty($first_login_time)) {
$coupon_service->sendCoupon((int)$id, 0, 0);
$content = '恭喜您您获得500元的新人专享返现红包,成交后可兑现';
$service->record(0,0,1, $content, 0, $id);
}
if (!empty($registration_time) && $referrer_source == 10 && $referrer_id) {
$coupon_service->sendCoupon((int)$referrer_id, $id, 2);
$content = '恭喜您您获得500元的邀请成交返现红包,好友成交后可兑现';
$service->record(0,0,2,$content, 0, $referrer_id);
}
$jwt = new JwtUntils(); $jwt = new JwtUntils();
$AuthToken = $jwt->createToken($jwt_data); $AuthToken = $jwt->createToken($jwt_data);
......
<?php
namespace app\api\untils;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/12
* Time: 17:02
*/
class CouponNoEncodingUntils{
const OR_NOT_VALUE = 123123123123;
private function reverse($s){
return strrev($s);
}
public function encryptionCouponNo($couponNo){
$couponNo = $this->reverse($couponNo );
return $couponNo ^ self::OR_NOT_VALUE;
}
public function decryptionCouponNo($couponNo){
$couponNo = $couponNo ^ self::OR_NOT_VALUE;
return $this->reverse($couponNo);
}
}
\ No newline at end of file
<?php
namespace app\api\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 9:49
*/
class ActivityValidate extends Validate
{
protected $rule = [
'id' => 'require',
'title' => 'require|length:1,80',
'return_type' => 'require|in:0,1',
'money' => 'require|number|gt:0|lt:5000',
'return_action' => 'require|in:0,1,2',
'activity_start_time' => 'require',
'activity_end_time' => 'require',
'use_period' => 'require|number',
'total' => 'require|number',
'available' => 'require|number',
'get_number' => 'require|number|gt:0',
'activity_rule' => 'require',
'status' => 'require|number|in:0,1,2,3,4,5',
];
protected $message = [
'id.require' => '活动id不能为空',
'title.length:1,80' => '活动标题字数必须1-80',
'return_type.require' => '奖励类型为必须字段',
'return_type.in' => '奖励类型错误',
'money.require' => '奖励金额为必填',
'money.number' => '奖励金额必须是数字',
'money.gt' => '奖励金额必须大于0',
'money.lt' => '奖励金额不能大于5000',
'return_action.require' => '奖励动作为必填',
'return_action.in' => '奖励动作值错误',
'activity_start_time.require' => '活动开始时间为必填',
'activity_end_time.require' => '活动结束时间为必填',
'use_period.require' => '使用有效期为必须字段',
'use_period.number' => '使用有效期必须是数字',
'total.require' => '可发放总数为必须字段',
'total.number' => '可发放总数必须是数字',
'available.require' => '用户可领数为必须字段',
'available.number' => '用户可领数必须是数字',
'get_number.require' => '已领数不能为空',
'get_number.number' => '已领数只能是数字',
'get_number.gt' => '已领数必须大于0',
'activity_rule.require' => '活动规则为必填',
'status.require' => '活动状态为必填',
'status.number' => '活动状态必须为数字',
'status.in' => '活动状态值错误',
];
protected $scene = [
'create' => ['title', 'return_type', 'money', 'return_action', 'activity_start_time', 'activity_end_time', 'use_period',
'total', 'available', 'activity_rule'],
];
}
\ No newline at end of file
...@@ -19,6 +19,7 @@ use app\model\OMarchInModel; ...@@ -19,6 +19,7 @@ use app\model\OMarchInModel;
use app\model\OrderModel; use app\model\OrderModel;
use app\model\ORefundModel; use app\model\ORefundModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\task\controller\ResultsSummaryNewTask;
use think\Exception; use think\Exception;
use Think\Log; use Think\Log;
...@@ -196,6 +197,11 @@ class OrderLog extends Basic ...@@ -196,6 +197,11 @@ class OrderLog extends Basic
"transfer_img" => "12312312312" "transfer_img" => "12312312312"
);*/ );*/
$vip_services = new VipService();
if($vip_services->vip($params['agent_id'], 'broker/collectingBill')){
return $this->response("101","没有权限");
}
$params["collecting_bill"] = json_decode($params["collecting_bill"], true); $params["collecting_bill"] = json_decode($params["collecting_bill"], true);
$remark = isset($params["remark"]) ? $params["remark"] : ""; $remark = isset($params["remark"]) ? $params["remark"] : "";
...@@ -253,6 +259,11 @@ class OrderLog extends Basic ...@@ -253,6 +259,11 @@ class OrderLog extends Basic
"receipt_number" => "12312", "receipt_number" => "12312",
"transfer_name" => "sdafsdf", "transfer_name" => "sdafsdf",
);*/ );*/
$vip_services = new VipService();
if($vip_services->vip($params['agent_id'], 'broker/collectingBill')){
return $this->response("101","没有权限");
}
......
...@@ -262,7 +262,7 @@ class DailyPaperService ...@@ -262,7 +262,7 @@ class DailyPaperService
$payLogModel = new OPayLogModel(); $payLogModel = new OPayLogModel();
//中介费入账 //中介费入账
$field = "a.id,c.id as bargain_id,b.house_id,c.price,a.money,a.pay_type,a.transfer_name,a.type,a.type_ext,a.income_time, $field = "a.id,c.id as bargain_id,b.house_id,c.price,a.money,a.pay_type,a.transfer_name,a.type,a.type_ext,a.income_time,
d.report_agent_id as agent_id,c.is_open,a.is_dividend,a.receipt_number,a.create_time,a.remark,a.received_money"; d.report_agent_id as agent_id,c.is_open,a.is_dividend,a.receipt_number,a.create_time,a.remark,a.received_money,a.transaction_fee";
$params["a.agent_id"] = array("in", ($ids)); $params["a.agent_id"] = array("in", ($ids));
$params["a.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59")); $params["a.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
$params["a.is_del"] = 0; $params["a.is_del"] = 0;
...@@ -281,7 +281,7 @@ class DailyPaperService ...@@ -281,7 +281,7 @@ class DailyPaperService
$field_money = "a.id,a.money,a.type,a.type_ext,b.house_id,b.id as order_id,a.pay_type,a.transfer_name, d.report_agent_id as agent_id, $field_money = "a.id,a.money,a.type,a.type_ext,b.house_id,b.id as order_id,a.pay_type,a.transfer_name, d.report_agent_id as agent_id,
a.is_dividend,a.receipt_number,a.create_time,a.income_time"; a.is_dividend,a.receipt_number,a.create_time,a.income_time,a.transaction_fee";
//意向金 //意向金
$params["a.type"] = 10; $params["a.type"] = 10;
unset($params["c.father_id"]); unset($params["c.father_id"]);
...@@ -294,8 +294,8 @@ class DailyPaperService ...@@ -294,8 +294,8 @@ class DailyPaperService
$payLogModel->selectPayLogListByBargainReport($field_money, $params) $payLogModel->selectPayLogListByBargainReport($field_money, $params)
); );
//调整出账 //调整出账
$field_adjustment = "b.id,c.house_id,b.new_paylog_id as pay_log_id,a.agent_id,b.money,a.income_time,b.type,a.receipt_number,a.create_time"; $field_adjustment = "b.id,c.house_id,b.new_paylog_id as pay_log_id,a.agent_id,b.money,a.income_time,b.type,a.receipt_number,a.create_time,a.transaction_fee,b.paylog_id as old_paylog_id";
$params_adjustment["a.agent_id"] = array("in", ($ids)); $params_adjustment["b.operation_id"] = array("in", ($ids));
$params_adjustment["a.is_del"] = 0; $params_adjustment["a.is_del"] = 0;
$params_adjustment["b.is_del"] = 0; $params_adjustment["b.is_del"] = 0;
$params_adjustment["b.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59")); $params_adjustment["b.create_time"] = array("between", array($daily_data, $daily_data . " 23:59:59"));
......
...@@ -661,7 +661,7 @@ class OrderLogService ...@@ -661,7 +661,7 @@ class OrderLogService
} }
} }
//调整 //调整
$field_adjustment = "a.id,a.paylog_id,a.new_paylog_id,a.type,a.money,a.create_time,a.update_time,c.name"; $field_adjustment = "a.id,a.paylog_id,a.new_paylog_id,d.order_id,a.type,a.money,a.create_time,a.update_time,c.name";
$adjustmentData = $oPayLogAdjustmentModel->getAdjustmentListByOrderId($field_adjustment, ["order_id" => $order_id, 'is_del'=>0]); $adjustmentData = $oPayLogAdjustmentModel->getAdjustmentListByOrderId($field_adjustment, ["order_id" => $order_id, 'is_del'=>0]);
if (count($adjustmentData) > 0) { if (count($adjustmentData) > 0) {
foreach ($adjustmentData as $k2 => $v2) { foreach ($adjustmentData as $k2 => $v2) {
...@@ -1406,7 +1406,7 @@ class OrderLogService ...@@ -1406,7 +1406,7 @@ class OrderLogService
$params["order_id"] = $order_id; $params["order_id"] = $order_id;
$bargainModel = new OBargainModel(); $bargainModel = new OBargainModel();
$filed = "a.id,a.father_id,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id, $filed = "a.id,a.father_id,a.price,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
d.id as house_id,d.internal_title,d.internal_address,c.order_no,a.report_id"; d.id as house_id,d.internal_title,d.internal_address,c.order_no,a.report_id";
$result = $bargainModel->selectBargainList($filed, $params,1, 15); $result = $bargainModel->selectBargainList($filed, $params,1, 15);
$list = []; $list = [];
......
...@@ -96,6 +96,10 @@ class UploadFileService ...@@ -96,6 +96,10 @@ class UploadFileService
$path .= 'static/agent_black_list/'; $path .= 'static/agent_black_list/';
$internet_path = 'static/agent_black_list/'; $internet_path = 'static/agent_black_list/';
break; break;
case 'check':
$path .= 'static/check/';
$internet_path = 'static/check/';
break;
default : default :
$data['code'] = 101; $data['code'] = 101;
$data['msg'] = "上传图片类型错误"; $data['msg'] = "上传图片类型错误";
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<p v-if="item.step_name==='adjustment'">调整ID:<span>{{item.id}}</span></p> <p v-if="item.step_name==='adjustment'">调整ID:<span>{{item.id}}</span></p>
<p v-if="item.step_name==='adjustment'">调整前收款ID:<span>{{item.paylog_id}}</span></p> <p v-if="item.step_name==='adjustment'">调整前收款ID:<span>{{item.paylog_id}}</span></p>
<p v-if="item.step_name==='adjustment'">调整后收款ID:<span>{{item.new_paylog_id}}</span></p> <p v-if="item.step_name==='adjustment'">调整后收款ID:<span>{{item.new_paylog_id}}</span></p>
<p v-if="item.step_name==='adjustment'">带看ID:<span>{{item.order_id}}</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 1">调整类型:<span>意向金转中介费</span></p> <p v-if="item.step_name==='adjustment' && item.type == 1">调整类型:<span>意向金转中介费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 2">调整类型:<span>意向金转案场费</span></p> <p v-if="item.step_name==='adjustment' && item.type == 2">调整类型:<span>意向金转案场费</span></p>
<p v-if="item.step_name==='adjustment' && item.type == 3">调整类型:<span>意向金转意向金</span></p> <p v-if="item.step_name==='adjustment' && item.type == 3">调整类型:<span>意向金转意向金</span></p>
......
...@@ -66,14 +66,21 @@ function download_file($archivo, $downloadfilename = null) { ...@@ -66,14 +66,21 @@ function download_file($archivo, $downloadfilename = null) {
* @param $url * @param $url
* @param $dir * @param $dir
* @param string $filename * @param string $filename
* @param $date
* @return bool|string * @return bool|string
*/ */
function down_file($url, $dir, $filename=''){ function down_file($url, $dir, $filename='', $date){
if(empty($url)){ if(empty($url)){
return false; return false;
} }
if (empty($date)) {
$date = date('Ymd'); $date = date('Ymd');
} else {
$date = date('Ymd', strtotime($date));
}
$ext = strrchr($url, '.'); $ext = strrchr($url, '.');
$dir = $dir.DS.$date; $dir = $dir.DS.$date;
......
<?php
namespace app\index\controller;
use app\api\service\AccountBalanceService;
use app\index\extend\Basic;
use think\Request;
class AccountBalance extends Basic
{
private $s_account_balance;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->s_account_balance = new AccountBalanceService();
}
/**
* @return \think\Response
*/
public function userAccountBalanceList()
{
$params = $this->params;
/* $params = array(
"create_time_start" => '2019-03-14 11:03:10',
"create_time_end" => '2019-03-15 11:03:10',
"user_phone" => '6471',
"user_id" => '111',
);*/
$data = $this->s_account_balance->getBalanceList($params);
if (count($data) <= 0) {
return $this->response("200", "null");
}
$result["list"] = $data;
$result["total"] = $this->s_account_balance->getBalanceCount($params);
return $this->response("200", "success!", $result);
}
/**
* @return \think\Response
*/
public function check()
{
$params = $this->params;
/* $params = array(
"operator_id" => 1,
"operator_name" => "1231",
"transfer_img" => "123123",
"status" => 1,
"id" => 1
);*/
if (empty($params["operator_id"]) || empty($params["operator_name"]) || empty($params["id"]) || empty($params["transfer_img"])) {
return $this->response("101", "请求参数错误");
}
$id = $params["id"];
$operator_id = $params["operator_id"];
$operator_name = $params["operator_name"];
$transfer_img = $params["transfer_img"];
$status = $params["status"];
if (!$status && ($status != 1 || $status != 2)) {
return $this->response("101", "审核状态错误");
}
$id = $this->s_account_balance->check($id,$operator_id,$operator_name,$transfer_img,$status);
if($id > 0){
return $this->response("200","success");
}else{
return $this->response("101","error");
}
}
}
\ No newline at end of file
<?php
namespace app\index\controller;
use app\index\extend\Basic;
use app\api\service\ActivityService;
use app\model\CActivity;
use think\Request;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 9:46
*/
class Activity extends Basic
{
private $activityService;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->activityService = new ActivityService();
}
/**
* 新增or修改活动
* doc url :http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=817
* @return \think\Response
*/
public function saveActivity()
{
$params = $this->params;
/*$params = array(
//'id' => 1,
'title' => '活动1',
'return_type' => '1',
'money' => '1121',
'return_action' => '0',
'activity_start_time' => time(),
'activity_end_time' => time(),
'use_period' => 30,
'total' => 100,
'available' => 1,
'activity_rule' => '加拉时间的发送去问问人情味',
);*/
$checkResult = $this->validate($params, "ActivityValidate.create");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$title = $params["title"];
//$return_type = $params["return_type"];
$money = $params["money"];
$return_action = $params["return_action"];
$activity_start_time = $params["activity_start_time"];
$activity_end_time = $params["activity_end_time"];
$use_period = $params["use_period"];
$total = $params["total"];
$available = $params["available"];
$activity_rule = $params["activity_rule"];
/* if (($return_action == 0 || $return_action == 1) && $return_type != 0) {
return $this->response("101", "奖励动作为首次或邀请登陆,奖励类型必须为返现红包");
}
if ($return_type == 1 && $use_period > 0) {
return $this->response("101", "奖励类型为现金的奖励有效期必须为永久");
}*/
//编辑
$id = 0;
if (!empty($params["id"])) {
$id = $params["id"];
} else {
if ($activity_start_time < time() || $activity_end_time < time()) {
return $this->response("101", "活动开始时间和结束时间不能小于当前时间");
}
}
$is_ok = $this->activityService->createActivity($id, $title, $money, $return_action, $activity_start_time,
$activity_end_time, $use_period, $total, $available, $activity_rule);
if ($is_ok > 0) {
return $this->response("200", "success");
} else {
return $this->response("101", "faild");
}
}
/**
* 获取活动列表
* doc url :http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=818
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getActivityList()
{
$params = $this->params;
/* $params = array(
"id" => 1,
"title" => "asd",
"pageNo" => 1,
"pageSize" => 15,
);*/
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$activityModel = new CActivity();
$field = 'id,title,return_type,money,return_action,activity_start_time,activity_end_time,use_period,total,
available,get_number,activity_rule,status,create_time';
$where_ = [];
if (!empty($params["title"])) {
$where_["title"] = array("like", "%" . trim($params['title']) . "%");
}
if (!empty($params["id"])) {
$where_["id"] = $params['id'];
}
$where_["status"] = array("neq", 4);
$list = $activityModel->getActivityList($field, $where_, $pageNo, $pageSize);
$count = $activityModel->getActivityCount($field, $where_);
$result["list"] = $list;
$result["total"] = $count;
return $this->response("200", "success", $result);
}
}
\ No newline at end of file
...@@ -11,12 +11,12 @@ namespace app\index\controller; ...@@ -11,12 +11,12 @@ namespace app\index\controller;
use app\index\extend\Basic; use app\index\extend\Basic;
class ShopInspectionLogTest extends Basic class CashAccount extends Basic
{ {
public function shopinspectionLogListTest() public function cashAccountList()
{ {
if (!$this->request->isAjax()) { if (!$this->request->isAjax()) {
return view('shopinspectiontest/shopinspectionLogListTest'); return view('redEnvelope/cashAccountList');
} }
} }
} }
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/3/13
* Time: 15:48
*/
use app\index\extend\Basic;
class CashBack extends Basic
{
public function cashBackList()
{
if (!$this->request->isAjax()) {
return view('redEnvelope/cashBackList');
}
}
}
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/3/11
* Time: 15:49
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\CActivity;
use app\model\CCoupon;
use app\model\Users;
use think\Request;
class Coupon extends Basic
{
private $m_coupon;
private $m_activity;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->m_coupon = new CCoupon();
$this->m_activity = new CActivity();
}
public function couponList() {
if (!$this->request->isAjax()) {
return view('cashBackList');
}
$page_no = empty($this->params['page_no']) ? 1 : $this->params['page_no'];
$page_size = empty($this->params['page_size']) ? 15 : $this->params['page_size'];
$where = $this->binWhere($this->params);
$field = 'id,user_id,activity_id,status,create_time';
$list = $this->m_coupon->getList($page_no, $page_size, 'id desc', $field, $where);
$total = $this->m_coupon->getTotal($where);
$m_user = new Users();
$field_activity = 'money,return_action';
foreach ($list as $k => $v) {
$activity_data = $this->m_activity->getFind($field_activity, ['id'=>$v['activity_id']]);
$list[$k]['money'] = $activity_data['money'];
$list[$k]['return_action'] = $activity_data['return_action'];
$list[$k]['user_id'] = $v['user_id'];
$list[$k]['user_phone'] = $m_user->getUserByWhereValue('user_phone', ['id'=>$v['user_id']]);
$list[$k]['user_phone'] = substr_replace($list[$k]['user_phone'], '****', 3, 4);
}
$data['total'] = $total;
$data['list'] = $list;
return $this->response(200, '', $data);
}
/**
* @param $params
* @return array
*/
protected function binWhere($params) {
$where = [];
if (isset($params['start_time']) && isset($params['end_time'])) {
$where['create_time'] = ['between', [$params['start_time'] . ' 00:00:00', $params['end_time'] . ' 23:59:59']];
}
if (isset($params['start_time']) && !isset($where['create_time'])) {
$where['create_time'] = $params['start_time'] . ' 00:00:00';
}
if (isset($params['end_time']) && !isset($where['create_time'])) {
$where['create_time'] = $params['end_time'] . ' 23:59:59';
}
if (isset($params['user_id'])) {
$where['user_id'] = $params['user_id'];
}
if (isset($params['id'])) {
$where['id'] = $params['id'];
}
if (isset($params['activity_id'])) {
$where['activity_id'] = $params['activity_id'];
}
if (isset($params['status'])) {
$where['status'] = $params['status'];
}
return $where;
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace app\index\controller; namespace app\index\controller;
use app\api\service\ConvertCouponService;
use app\api\untils\MessageUntils; use app\api\untils\MessageUntils;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
use app\index\extend\Basic; use app\index\extend\Basic;
...@@ -180,25 +181,14 @@ class ImageDepot extends Basic ...@@ -180,25 +181,14 @@ class ImageDepot extends Basic
public function ceshi() public function ceshi()
{ {
$service = new ConvertCouponService();
$service->convertCoupon(135281, 12,12,12); //核销红包
$messageUntil = new MessageUntils(); dump(0);exit;
$data = '朱伟2';
$result = $messageUntil->sendSMSForUser('18112347151',$data,'415209');
if ($result == 'true') {
return $this->response("200", "短信发送成功", $result);
} else {
return $this->response("101", $result);
}
} }
}
}
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: liu yin ping
* Date: 2018/3/13
* Time: 15:48
*/
use app\index\extend\Basic;
class RedEnvelope extends Basic
{
public function redEnvelopeList()
{
if (!$this->request->isAjax()) {
return view('redEnvelope/redEnvelopeList');
}
}
}
...@@ -82,7 +82,13 @@ class Basic extends Controller ...@@ -82,7 +82,13 @@ class Basic extends Controller
'index/uploadEditor', 'index/uploadEditor',
'index/downloadFile', 'index/downloadFile',
'index/getStoreRandKingListByAgentId', 'index/getStoreRandKingListByAgentId',
'index/getRandKingListByAgentId' 'index/getRandKingListByAgentId',
'index/saveActivity',
'index/getActivityList',
'index/checkReferrer',
'index/getActivityCoupon',
'index/userAccountBalanceList',
'index/ceshi',
); );
/** /**
......
...@@ -115,7 +115,7 @@ class UserService ...@@ -115,7 +115,7 @@ class UserService
//记录邀请人修改记录 //记录邀请人修改记录
if (!empty($data['referrer_id'])) { if (!empty($data['referrer_id'])) {
$this->recordReferrer($data['referrer_id'], $data['referrer_source'], $id, $referrer_id_old, $referrer_source_old, $type); $this->recordReferrer($data['referrer_id'], $data['referrer_source'], $id, $referrer_id_old);
} }
//更新业绩统计 //更新业绩统计
...@@ -201,15 +201,13 @@ class UserService ...@@ -201,15 +201,13 @@ class UserService
/** /**
* 记录邀请人修改记录 * 记录邀请人修改记录
*
* @param $referrer_id * @param $referrer_id
* @param $referrer_source * @param $referrer_source
* @param $user_id * @param $user_id
* @param $referrer_id_old * @param $referrer_id_old
* @param string $type
* @return array * @return array
*/ */
public function recordReferrer($referrer_id, $referrer_source, $user_id, $referrer_id_old, $referrer_source_old, $type = 'add') public function recordReferrer($referrer_id, $referrer_source, $user_id, $referrer_id_old)
{ {
$result = []; $result = [];
$remark = ''; $remark = '';
...@@ -227,7 +225,9 @@ class UserService ...@@ -227,7 +225,9 @@ class UserService
$user_phone = $agent_data[0]['phone']; $user_phone = $agent_data[0]['phone'];
} }
if ($type == 'add') {
$if_inviter = $this->getUserInviterHistory($user_id);//查询是否存在邀请人修改记录
if (!$if_inviter) {//无记录则为新增
if ($referrer_source == 10) { if ($referrer_source == 10) {
$remark = '新增为' . $name . '-' . $user_phone . ',客户ID:' . $referrer_id; $remark = '新增为' . $name . '-' . $user_phone . ',客户ID:' . $referrer_id;
} else { } else {
...@@ -264,6 +264,22 @@ class UserService ...@@ -264,6 +264,22 @@ class UserService
return $result; return $result;
} }
/**
* 查询客户是否有邀请人
* @param $user_id
* @return array|false|\PDOStatement|string|\think\Collection
*/
public function getUserInviterHistory($user_id)
{
$m_records = new GOperatingRecords();
//客方修改日志
$param_['user_id'] = $user_id;
//邀请人修改日志
$param_['type'] = 5;
return $m_records->user_history($param_);
}
/** /**
* @param $code * @param $code
* @return string * @return string
...@@ -664,9 +680,9 @@ class UserService ...@@ -664,9 +680,9 @@ class UserService
{ {
$m_agent = new AAgents(); $m_agent = new AAgents();
// 判断经纪人表是否存在 // 判断经纪人表是否存在
$agent_res = $m_agent->findByOne('id', ["phone" => $phone,"status" => 0]); $agent_res = $m_agent->findByOne('id,name,phone', ["phone" => $phone,"status" => 0]);
// 判断客户表是否存在 // 判断客户表是否存在
$user_res = $this->user->findByOne('id', ["user_phone" => $phone,"status" => 0]); $user_res = $this->user->findByOne('id,user_name,user_phone', ["user_phone" => $phone,"status" => 0]);
if(!$agent_res && !$user_res){ if(!$agent_res && !$user_res){
return 4; return 4;
...@@ -676,19 +692,35 @@ class UserService ...@@ -676,19 +692,35 @@ class UserService
// 邀请人 为 经纪人 经纪人表客户表同时存在 // 邀请人 为 经纪人 经纪人表客户表同时存在
$referrer_source = 20; $referrer_source = 20;
$referrer_id = $agent_res['id']; $referrer_id = $agent_res['id'];
$name = $agent_res['name'];
$user_phone = $agent_res['phone'];
} else { } else {
// 邀请人 为 经纪人 只存在于客户表 // 邀请人 为 经纪人 只存在于客户表
$referrer_source = 10; $referrer_source = 10;
$referrer_id = $user_res['id']; $referrer_id = $user_res['id'];
$name = $agent_res['user_name'];
$user_phone = $agent_res['user_phone'];
} }
if(($referrer_source == 10) and ($user_id == $referrer_id)){ if(($referrer_source == 10) and ($user_id == $referrer_id)){
return 2; return 2;//不能绑定自己
} }
$res = $this->user->setUserInvite($user_id,$referrer_source,$referrer_id); $res = $this->user->setUserInvite($user_id,$referrer_source,$referrer_id);
return $res == 1 ? 1 : 0; if($res == 1){
//修改成功记录一下邀请人新增日志日志
if ($referrer_source == 10) {
$remark = '新增为' . $name . '-' . $user_phone . ',客户ID:' . $referrer_id;
} else {
$remark = '新增为' . $name . '-' . $user_phone;
}
$this->operating_records(1, 5, $remark, $user_id); //邀请人修改-客户
return 1;
}else{
return 0;
}
} }
} }
\ No newline at end of file
<?php
namespace app\index\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/11
* Time: 9:49
*/
class ActivityValidate extends Validate
{
protected $rule = [
'id' => 'require',
'title' => 'require|length:1,80',
// 'return_type' => 'require|in:0,1',
'money' => 'require|number|gt:0|lt:5000',
'return_action' => 'require|in:0,1,2',
'activity_start_time' => 'require',
'activity_end_time' => 'require',
'use_period' => 'require|number',
'total' => 'require|number',
'available' => 'require|number',
'get_number' => 'require|number|gt:0',
'activity_rule' => 'require',
'status' => 'require|number|in:0,1,2,3,4,5',
];
protected $message = [
'id.require' => '活动id不能为空',
'title.length:1,80' => '活动标题字数必须1-80',
/* 'return_type.require' => '奖励类型为必须字段',
'return_type.in' => '奖励类型错误',*/
'money.require' => '奖励金额为必填',
'money.number' => '奖励金额必须是数字',
'money.gt' => '奖励金额必须大于0',
'money.lt' => '奖励金额不能大于5000',
'return_action.require' => '奖励动作为必填',
'return_action.in' => '奖励动作值错误',
'activity_start_time.require' => '活动开始时间为必填',
'activity_end_time.require' => '活动结束时间为必填',
'use_period.require' => '使用有效期为必须字段',
'use_period.number' => '使用有效期必须是数字',
'total.require' => '可发放总数为必须字段',
'total.number' => '可发放总数必须是数字',
'available.require' => '用户可领数为必须字段',
'available.number' => '用户可领数必须是数字',
'get_number.require' => '已领数不能为空',
'get_number.number' => '已领数只能是数字',
'get_number.gt' => '已领数必须大于0',
'activity_rule.require' => '活动规则为必填',
'status.require' => '活动状态为必填',
'status.number' => '活动状态必须为数字',
'status.in' => '活动状态值错误',
];
protected $scene = [
'create' => ['title', 'money', 'return_action', 'activity_start_time', 'activity_end_time', 'use_period',
'total', 'available', 'activity_rule'],
];
}
\ No newline at end of file
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="cashBackList" />
<style>
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">返现红包</a></li>
<div class="pull-right">
<ul class="bread_btn">
<li>
</li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="table-responsive" >
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="12">
<form id="form_search">
<span class="fore-span ld-Marheight">发放时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_start" name="start_date1" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_end" name="end_date1" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_id" placeholder="客户ID" type="text">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="red_bag_id" placeholder="红包ID" type="text">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="activity_id" placeholder="活动ID" type="text">
<select class="form-control btn2 ld-Marheight" id="staus_red">
<option value="-1">红包状态</option>
<option value="0">有效</option>
<option value="1">已使用</option>
<option value="2">过期</option>
</select>
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
</form>
</td>
</tr>
<tr class="main_table_th_tr">
<th class="text-center">发放时间</th>
<th class="text-center">返现红包ID</th>
<th class="text-center">红包金额</th>
<th class="text-center">奖励动作</th>
<th class="text-center">客户ID</th>
<th class="text-center">客户手机号</th>
<th class="text-center">状态</th>
</tr>
</thead>
<tbody class="text-center" id="picture_list"></tbody>
</table>
</div>
<!-- /#page-content-wrapper -->
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{layout name="global/frame_two_tpl" /} {layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="reportList" /> <input type="hidden" class="page-load" id="reportList" />
<style type="text/css"> <style type="text/css">
.envelope-list{
position: relative;
left: -144px;
opacity: 0;
}
.envelope-details{
font-size: 18px;
font-weight: 600;
}
.clear{ .clear{
clear: both; clear: both;
} }
...@@ -432,8 +442,9 @@ ...@@ -432,8 +442,9 @@
<br /> <br />
<span class="text-danger" style="float: left;font-weight: 600;font-size: 18px;">注:页面查看不完整 请隐藏菜单!!!</span> <span class="text-danger" style="float: left;font-weight: 600;font-size: 18px;">注:页面查看不完整 请隐藏菜单!!!</span>
<div href="#modal_date_select" data-toggle="modal">打开收佣日期选择框(默认隐藏)</div> <div href="#modal_date_select" data-toggle="modal">打开收佣日期选择框(默认隐藏)</div>
<a id="maid_ok_btn" class="btn btn-primary" data-toggle="modal">确认分佣</a> <a class="btn btn-primary maid_ok_btn">确认分佣</a>
<a id="maid_save_btn" class="btn btn-primary" data-toggle="modal">保存</a> <a id="maid_save_btn" class="btn btn-primary" data-toggle="modal">保存</a>
<a class="btn btn-success envelope-list" href="#modal-envelope" data-toggle="modal">红包提现</a>
</div> </div>
<!--分佣提成--> <!--分佣提成-->
</div> </div>
...@@ -665,29 +676,55 @@ ...@@ -665,29 +676,55 @@
<!-- /.modal --> <!-- /.modal -->
</div> </div>
<!--商铺详情 弹出框-->
<!--商铺详情 跟进记录-->
<div class="modal fade" id="modal_shop_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="modal_shop_detail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog modal-dialog-one">
<div class="modal-content"> <div class="modal-content" style="height: 700px;">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
× &times;
</button> </button>
<h4 class="modal-title"> <h4 class="modal-title detail-modal-header-tab-liu" >
商铺详情 <a href="javascript:;" class="btn btn-default">查看商铺</a>
<a href="javascript:;" class="btn btn-info">商铺跟进</a>
</h4> </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body modal-body-one">
<div class="detail-modal-body-sec-liu">
<iframe class="iframe-shop-detail"></iframe> <iframe class="iframe-shop-detail"></iframe>
</div> </div>
<div class="modal-footer"> <div class="detail-modal-body-sec-liu">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭 <div class="followup-modal-list-area">
</button> <table class="table table-striped table-bordered table-hover table-condensed">
<tbody class="" id="modal_followup_table_list">
<tr>
<td>电话跟进:测试测试测试测试测试测试测试测试测试测试测试测试</td>
<td>刘丹丹</td>
<td>2017-09-05 15:22:33</td>
</tr>
<tr>
<td colspan="3">2017-09-05 15:22:33</td>
</tr>
</tbody>
</table>
</div> </div>
</div><!-- /.modal-content --> <!--<div class="followup-modal-comment-area">
</div><!-- /.modal --> <textarea></textarea>
</div> </div>
<div class="btn-top-house">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="modal_followup_submit_btn">提交</button>
</div>-->
</div>
</div>
</div>
</div>
</div>
<!--客户详情 弹出框--> <!--客户详情 弹出框-->
<!--客户详情 客户跟进 不可编辑--> <!--客户详情 客户跟进 不可编辑-->
<div class="modal fade" id="modal_user_detail" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal fade" id="modal_user_detail" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
...@@ -1206,3 +1243,47 @@ ...@@ -1206,3 +1243,47 @@
</div> </div>
<!-- /.modal --> <!-- /.modal -->
</div> </div>
<!--红包提现 弹出框-->
<div class="modal fade" id="modal-envelope" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width: 1100px;">
<div class="modal-content" style="height: 639px;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
确认分佣
</h4>
</div>
<div class="modal-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th class="text-center">客户类型</th>
<th class="text-center">返现红包</th>
<th class="text-center">活动名称</th>
<th class="text-center">有效期</th>
<th class="text-center">客户ID</th>
<th class="text-center">客户手机号</th>
</tr>
</thead>
<tbody class="text-center" id="maintable_envelope_list">
</tbody>
</table>
</div>
<div class="envelope-details" style="margin-bottom: 30px;">注:确认分佣后系统会立即返现现金到对应的客户账户上</div>
</div>
<div class="modal-footer">
<button type="button btn2" class="btn btn-primary maid_ok_btn" id="" data-dismiss="modal">
确认分佣
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
\ No newline at end of file
...@@ -73,6 +73,13 @@ ...@@ -73,6 +73,13 @@
<tr> <tr>
<td colspan="14"> <td colspan="14">
<form id="maintable_form_search"> <form id="maintable_form_search">
<select class="form-control btn2 margin-top-ld" id="financial_city_choose">
<option value="0">选择城市</option>
<option value="10001">上海市</option>
<option value="10002">杭州市</option>
<option value="10003">深圳市</option>
</select>
<span class="fore-span margin-left-10">提交时间:</span> <span class="fore-span margin-left-10">提交时间:</span>
<input class="form-control btn4" value="" data-rule-phoneus="false" data-rule-required="false" id="maintable_create_time" name="start_date" type="date"> <input class="form-control btn4" value="" data-rule-phoneus="false" data-rule-required="false" id="maintable_create_time" name="start_date" type="date">
<span class="fore-span margin-left-10"></span> <span class="fore-span margin-left-10"></span>
......
...@@ -355,14 +355,14 @@ ...@@ -355,14 +355,14 @@
<select class="form-control btn2 ld-Marheight" id="maintable_deal_type"> <select class="form-control btn2 ld-Marheight" id="maintable_deal_type">
<option value="">入账类型</option> <option value="">入账类型</option>
<option value="10">意向金</option> <option value="10">意向金</option>
<option value="20">定金</option> <!--<option value="20">定金</option>-->
<option value="30">保管金</option> <option value="30">保管金</option>
<option value="40">押金</option> <!--<option value="40">押金</option>
<option value="50">租金</option> <option value="50">租金</option>
<option value="60">进场费</option> <option value="60">进场费</option>
<option value="70">转让费</option> <option value="70">转让费</option>
<option value="80">其他</option> <option value="80">其他</option>
<option value="90">佣金</option> <option value="90">佣金</option>-->
<option value="91">中介费</option> <option value="91">中介费</option>
<option value="92">案场费</option> <option value="92">案场费</option>
</select> </select>
...@@ -407,7 +407,7 @@ ...@@ -407,7 +407,7 @@
<ul class="user-ul" style="display:none"></ul> <ul class="user-ul" style="display:none"></ul>
<span class="btn btn-info btn3 ld-Marheight" id="search" style="float:left">搜索</span> <span class="btn btn-info btn3 ld-Marheight" id="search" style="float:left">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset" style="float:left">重置</span> <span class="btn btn-info btn3 ld-Marheight" id="reset" style="float:left">重置</span>
<span class="btn btn-info btn3 ld-Marheight" id="export" style="float: left;">导出报表</span>
<!--<span class="money_total_two fore-span ld-Marheight ">实付总额:</span><span id="money_total" class="money_total_two_shifu fore-span ld-Marheight">1268</span>元--> <!--<span class="money_total_two fore-span ld-Marheight ">实付总额:</span><span id="money_total" class="money_total_two_shifu fore-span ld-Marheight">1268</span>元-->
<!--<span class="btn btn-info btn3 ld-Marheight" id="export" style="float:left">导出报表</span>--> <!--<span class="btn btn-info btn3 ld-Marheight" id="export" style="float:left">导出报表</span>-->
<!--<span class="btn btn-info btn3 ld-Marheight" id="count" style="float:left">统计</span>--> <!--<span class="btn btn-info btn3 ld-Marheight" id="count" style="float:left">统计</span>-->
...@@ -690,7 +690,16 @@ ...@@ -690,7 +690,16 @@
<div class="col-xs-6"> <div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<strong><span class="col-xs-3 ld-Marheight">入账类型:</span></strong> <strong><span class="col-xs-3 ld-Marheight">入账类型:</span></strong>
<span id="intoType" class="col-xs-6 ld-Marheight">中介费</span> <!--<span id="intoType" class="col-xs-6 ld-Marheight">中介费</span>-->
<span class="col-xs-6">
<select class="form-control" id="intoType">
<option value="10" class="intention-gold-liu">意向金</option>
<option value="30" class="intention-gold-liu">保管金</option>
<option value="91" class="agency-fees-liu">中介费</option>
<option value="92" class="agency-fees-liu">案场费</option>
</select>
</span>
</div> </div>
</div> </div>
<!--收款详情 加中介费类型 之前已收佣--> <!--收款详情 加中介费类型 之前已收佣-->
...@@ -791,12 +800,12 @@ ...@@ -791,12 +800,12 @@
<span id="person" class="col-xs-6 ld-Marheight"></span> <span id="person" class="col-xs-6 ld-Marheight"></span>
</div> </div>
</div> </div>
<div class="col-xs-6"> <!--<div class="col-xs-6">
<div class="form-group"> <div class="form-group">
<strong><span class="col-xs-3 ld-Marheight">所属门店:</span></strong> <strong><span class="col-xs-3 ld-Marheight">所属门店:</span></strong>
<span id="belongT" class=" col-xs-6 ld-Marheight"></span> <span id="belongT" class=" col-xs-6 ld-Marheight"></span>
</div> </div>
</div> </div>-->
</div> </div>
<div class="col-xs-12"> <div class="col-xs-12">
......
...@@ -357,6 +357,7 @@ ...@@ -357,6 +357,7 @@
</select> </select>
<span class="btn btn-info btn3 ld-Marheight" id="search" style="float:left">搜索</span> <span class="btn btn-info btn3 ld-Marheight" id="search" style="float:left">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset" style="float:left">重置</span> <span class="btn btn-info btn3 ld-Marheight" id="reset" style="float:left">重置</span>
<span class="btn btn-info btn3 ld-Marheight" id="export" style="float: left;">导出报表</span>
<!--<span class="btn btn-info btn3 ld-Marheight" id="export" style="float:left">导出excel</span>--> <!--<span class="btn btn-info btn3 ld-Marheight" id="export" style="float:left">导出excel</span>-->
<!--<span class="btn btn-info btn3 ld-Marheight" id="count" style="float:left">统计</span>--> <!--<span class="btn btn-info btn3 ld-Marheight" id="count" style="float:left">统计</span>-->
<!--<span class="money_total_two ld-Marheight " style="float:left">退意向金:</span><span style="float:left" id="back_yixiang" class="money_total_two_shifu fore-span ld-Marheight">0元</span>--> <!--<span class="money_total_two ld-Marheight " style="float:left">退意向金:</span><span style="float:left" id="back_yixiang" class="money_total_two_shifu fore-span ld-Marheight">0元</span>-->
......
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="cashAccountList" />
<style>
#file_input_pic {
opacity: 0;
position: absolute;
top: 19px;
left: 165px;
height: 43px;
width: 76px;
}
#container_body_img_area>div{
float: left;
width: 216px;
}
.result {
width:130px;
height:auto;
float:left;
text-align:center;
color:red;
}
.result>img,.result2>img{
width: 120px;
height: 120px;
margin-top: 8px;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">账户明细</a></li>
<div class="pull-right">
<ul class="bread_btn">
<li>
</li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="table-responsive" >
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="12">
<form id="form_search">
<span class="fore-span ld-Marheight">变动时间:</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_start" name="start_date1" type="date">
<span class="fore-span ld-Marheight">-</span>
<input class="form-control btn4 ld-Marheight" value="" data-rule-phoneus="false" data-rule-required="false" id="create_time_end" name="end_date1" type="date">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_id" placeholder="客户ID" type="text" value="">
<input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="user_phone" placeholder="客户手机号" type="text" value="">
<!-- <input class="form-control btn2 ld-Marheight" data-rule-phoneus="false" data-rule-required="false" id="dish" placeholder="客户昵称" type="text" value="" name="store_name">-->
<span class="btn btn-info btn3 ld-Marheight" id="search">搜索</span>
<span class="btn btn-info btn3 ld-Marheight" id="reset">重置</span>
<!--<div style="margin-left: 8px;font-size: 18px;font-weight: 600;">
<span>待审核金额:</span><span>50000元</span>
<span>提现成功金额:</span><span>4500元</span>
<span>未提现总额:</span><span>4500元</span>
</div>-->
</form>
</td>
</tr>
<tr class="main_table_th_tr">
<th class="text-center">变动时间</th>
<th class="text-center">变动金额</th>
<th class="text-center">变动类型</th>
<th class="text-center">客户ID</th>
<th class="text-center">客户手机号</th>
<th class="text-center">审核人</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody class="text-center" id="picture_list"></tbody>
</table>
</div>
<!-- /#page-content-wrapper -->
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--审核 上传图片-->
<div class="modal fade" id="modal-addPic" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
审核通过
</h4>
</div>
<div class="modal-body" style="height: 600px;">
<div>
<div style="height: 600px;">
<div class="form-group full-width-100 full-pic-area">
<!--input上传图片-->
<div id="container_body">
<label>请选择一个图像文件:</label>
<button type="button btn2" class="btn btn-default">上传图片</button>
<input type="file" id="file_input_pic"/>
<div id="container_body_img_area"></div>
</div>
</div>
<ul class="img-pre-ul" id="xiangqing_pic_ul">
</ul>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button btn2" class="btn btn-primary" id="saveBtn" data-dismiss="modal">
保存
</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal -->
</div>
{layout name="global/frame_two_tpl" /}
<input type="hidden" class="page-load" id="redEnvelopeList" />
<style>
.input-width{
display: inline-block;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}
.input-width-s{
width: 100px;
}
.input-width-m{
width: 180px;
}
.input-width-l{
width: 400px;
}
</style>
<div id="page-content-wrapper">
<div class="container">
<div class="row">
<div class="">
<div class="panel panel-default">
<div class="panel-heading breadcrumb">
<li><a href="#">活动列表</a></li>
<div class="pull-right">
<ul class="bread_btn">
<li>
<a class="btn btn-info add-activity" data-toggle="modal" href="#modal-add">新增活动</a>
</li>
</ul>
</div>
</div>
<div class="panel-body">
<div class="table-responsive" >
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<td colspan="12">
<form id="form_search">
<span class="btn btn-info btn3 ld-Marheight" id="search">刷新</span>
</form>
</td>
</tr>
<tr class="main_table_th_tr">
<th class="text-center">提交时间</th>
<th class="text-center">活动ID</th>
<th class="text-center">活动名称</th>
<th class="text-center">金额(元)</th>
<!--<th class="text-center">奖励类型</th>-->
<th class="text-center">奖励动作</th>
<th class="text-center">开始时间-结束时间</th>
<th class="text-center">状态</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody class="text-center" id="picture_list"></tbody>
</table>
</div>
<!-- /#page-content-wrapper -->
<div class="text-right" id="pagediv">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width: 800px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title">
新增奖励活动
</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id='form_reset'>
<div class="form-group">
<label class="col-sm-3 control-label">活动名称:</label>
<input type="text" value="" name="title" class="input-width-l input-width" placeholder="请输入" id="activity-title">
</div>
<!--<div class="form-group">
<label class="col-sm-3 control-label">奖励类型:</label>
<input type="radio" name="return_type" value="0"><label class="control-label">返现红包</label>&nbsp;&nbsp;
<input type="radio" name="return_type" value="1"><label class="control-label">现金</label>
</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">金额:</label>
<input type="number" class="input-width-s input-width" value="0" id="activity-money">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">发放动作:</label>
<input type="radio" name="return_action" value="0"><label class="control-label">首次登陆</label>&nbsp;&nbsp;
<input type="radio" name="return_action" value="2"><label class="control-label">邀请成交</label>&nbsp;&nbsp;
</div>
<div class="form-group">
<label class="col-sm-3 control-label">兑现动作:</label>
<label class="control-label confirm-commission">自己的订单确认分佣</label>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">活动有效期:</label>
<label class="control-label">创建时间:</label>
<input class="input-width-m input-width" type="text" value="" id="activity_start_date"
onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})"/>
<label class="control-label"></label>
<input class="input-width-m input-width" type="text" value="" id="activity_end_date"
onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})"/>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">奖励有效期:</label>
<input type="radio" name="award-period" value="-1"><label class="control-label">不限</label>
<input type="radio" name="award-period" value="0"><label class="control-label">发放日后的</label>
<input type="number" value="0" class="input-width-s input-width" id="activity-day">天内有效
<!--<label>发放日后的</label><input type="number" value="0" class="input-width-s input-width" id="red-day"><label>天内有效</label>-->
</div>
<div class="form-group">
<label class="col-sm-3 control-label">活动发放总次数:</label>
<input type="radio" name="activity-total" value="-1"><label class="control-label">不限</label>
<input type="radio" name="activity-total" value="0"><label class="control-label">最多</label>
<input type="number" value="0" class="input-width-s input-width" id="activity-total-num">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">用户可得红包数:</label>
<input type="radio" name="activity-total-bag" value="-1"><label class="control-label">不限</label>
<input type="radio" name="activity-total-bag" value="0"><label class="control-label">最多</label>
<input type="number" value="0" class="input-width-s input-width" id="activity-bag-num">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">活动规则:</label>
<textarea name="" rows="" cols="" style="height: 80px;width: 300px;border-radius: 6px;" id="activity-rule"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary submit_add">
提交
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<?php
namespace app\model;
use think\Db;
use think\Model;
class CActivity extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'c_activity';
private $db_;
public function __construct($data = [])
{
parent::__construct($data);
$this->db_ = Db::table($this->table);
}
public function addActivity($data)
{
Db::startTrans();
$id = 0;
try {
$id = $this->db_->insertGetId($data);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
}
return $id;
}
public function editorActivity($id,$data)
{
Db::startTrans();
try {
$this->where('id', $id)->update($data);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
/**
* 查询
*
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getActivity($field,$params)
{
if (!isset($params['status'])) {
$params['status'] = 0;
}
$result = $this->db_
->field($field)
->where($params)
->select();
//dump($this->getLastSql());
return $result;
}
/**
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getActivityList($field,$params,$pageNo,$pageSize)
{
$result = $this->db_
->field($field)
->where($params)
->order("id desc")
->page($pageNo)
->limit($pageSize)
->select();
return $result;
}
/**
* @param $field
* @param $params
* @return int|string
*/
public function getActivityCount($field,$params)
{
$result = $this
->field($field)
->where($params)
->count();
return $result;
}
/**
* 更新
* @param $activity_id
* @param $status
* @return $this
*/
public function updateStatus($activity_id, $status)
{
$result = $this->db_->where(['id' => $activity_id])->update(['status' => $status]);
// big_log($this->getLastSql());
return $result;
}
/**
* @param int $activity_id
* @return int|true
* @throws \think\Exception
*/
public function plusGetNumber(int $activity_id)
{
return $this->db_->table($this->table)->where('id', $activity_id)->setInc('get_number',1);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getFind($field, $where) {
return $this->field($field)->where($where)->find();
}
}
<?php
/**
* Created by PhpStorm.
* User: 43897
* Date: 2019/3/11
* Time: 10:23
*/
namespace app\model;
use think\Db;
class CCoupon extends BaseModel
{
// 设置当前模型对应的完整数据表名称
protected $table = 'c_coupon';
private $db_;
public function __construct()
{
$this->db_ = Db::name($this->table);
}
public function addCoupon($data) {
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
return $this->insert($data);
}
/**
* 查询
*
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCoupon($field,$params)
{
if (!isset($params['status'])) {
$params['status'] = 0;
}
$result = $this->db_
->field($field)
->where($params)
->select();
//dump($this->getLastSql());
return $result;
}
public function getCouponJoinActivity($field,$params)
{
$result = $this->db_
->field($field)
->alias("a")
->join("c_activity b","a.activity_id = b.id","left")
->where($params)
->select();
//dump($this->getLastSql());
return $result;
}
/**
* @param $field
* @param $params
* @return array
*/
public function getCouponColumn($field,$params)
{
if (!isset($params['status'])) {
$params['status'] = 0;
}
$result = $this->db_
->where($params)
->column($field);
//dump($this->getLastSql());
return $result;
}
/**
* @param $where
* @param string $field
* @return mixed
*/
public function getCount($where, $field = 'id'){
return $this->db_->where($where)
->count($field);
}
/**
* @param $data
* @return int|string
*/
public function insertData($data) {
if (is_array($data[0])) {
$result = $this->db_->insertAll($data);
} else {
$result = $this->db_->insertGetId($data);
}
return $result;
}
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function updateData($data, $where) {
return $this->db_->where($where)->update($data);
}
/**
*
*/
public function startTrans() {
$this->db_->startTrans();
}
/**
* @throws \think\exception\PDOException
*/
public function rollBackTrans() {
$this->db_->rollback();
}
/**
* @throws \think\exception\PDOException
*/
public function commitTrans() {
$this->db_->commit();
}
public function updateStatus($id, $status)
{
$result = $this->db_
->where(['id' => $id])
->update(['status' => $status]);
// big_log($this->getLastSql());
return $result;
}
public function updateUseStatus($id, $status,$report_id,$bargain_id,$order_id,$use_time)
{
$result = $this->db_
->where(['id' => $id])
->update(['status' => $status,'report_id' => $report_id,'bargain_id' => $bargain_id,'order_id' => $order_id,'use_time' => $use_time]);
// big_log($this->getLastSql());
return $result;
}
}
\ No newline at end of file
...@@ -1146,6 +1146,32 @@ class OBargainModel extends Model ...@@ -1146,6 +1146,32 @@ class OBargainModel extends Model
return $result; return $result;
} }
/**
* 成交报告详情-分佣提成
*
* @param $pageNo
* @param $pageSize
* @param string $order_
* @param $fields
* @param $where
* @param int $bargain_id
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainPartialV2($pageNo, $pageSize, $order_ = 'id desc', $fields, $where, $bargain_id = 0)
{
return $this->field($fields)
->alias('a')
->join('a_agents b', 'a.agent_id = b.id', 'left')
->where($where)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/** /**
* 分佣提成汇总表 * 分佣提成汇总表
* *
......
...@@ -487,4 +487,20 @@ class OPartialCommission extends BaseModel ...@@ -487,4 +487,20 @@ class OPartialCommission extends BaseModel
return $num; return $num;
} }
/**
* @param string $field
* @param array $where
* @param string $order
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getPartialList(string $field, array $where, $order = 'id asc') {
return $this->field($field)
->where($where)
->order($order)
->select();
}
} }
\ No newline at end of file
...@@ -55,6 +55,7 @@ class OPayLogAdjustment extends BaseModel{ ...@@ -55,6 +55,7 @@ class OPayLogAdjustment extends BaseModel{
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_paylog b","a.paylog_id=b.id") ->join("o_paylog b","a.paylog_id=b.id")
->join("o_paylog d","a.new_paylog_id=d.id")
->join("a_agents c","a.operation_id=c.id") ->join("a_agents c","a.operation_id=c.id")
->where($where_) ->where($where_)
->select(); ->select();
......
...@@ -348,6 +348,8 @@ class OPayLogModel extends Model ...@@ -348,6 +348,8 @@ class OPayLogModel extends Model
->select(); ->select();
} }
/** /**
* 收款记录总数 * 收款记录总数
* *
...@@ -595,4 +597,27 @@ class OPayLogModel extends Model ...@@ -595,4 +597,27 @@ class OPayLogModel extends Model
} }
return $this->db_->where($where)->value($field); return $this->db_->where($where)->value($field);
} }
public function getPayLogByUserId($field, $params)
{
$where_ = [];
if (isset($params["user_id"])) {
$where_["b.user_id"] = $params["user_id"];
}
if (isset($params["type"])) {
$where_["a.type"] = $params["type"];
}
$where_["a.is_del"] = 0;
return $this->db_
->field($field)
->alias("a")
->join("o_report b", "a.report_id = b.id", "left")
->where($where_)
->order('a.create_time asc')
->find();
}
} }
\ No newline at end of file
...@@ -37,6 +37,21 @@ class ORealIncome extends BaseModel ...@@ -37,6 +37,21 @@ class ORealIncome extends BaseModel
->select(); ->select();
} }
/**
* @param int $bargain_id
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainIncome(int $bargain_id, $field = 'id as fee_id,money,income_time') {
return $this->field($field)
->where('bargain_id', $bargain_id)
->where('is_del', 0)
->find();
}
/** /**
* @param int $field * @param int $field
* @param array $where * @param array $where
......
...@@ -237,6 +237,19 @@ class ORefundModel extends Model{ ...@@ -237,6 +237,19 @@ class ORefundModel extends Model{
->select(); ->select();
} }
public function getCheckRefundListForExcel($order_ = 'id desc', $field = '', $params = '') {
return $this->db_->alias('a')
->field($field)
->join('o_order b', 'a.order_id = b.id', 'left')
->join('a_agents c', 'a.agent_id = c.id', 'left')
->join('o_paylog d', 'a.pay_log_id = d.id', 'left')
->join('o_refund_log e', 'a.id = e.refund_id', 'left')
->where($params)
->order($order_)
->group('a.id')
->select();
}
/** /**
* 退款列表 * 退款列表
* *
......
...@@ -280,6 +280,7 @@ class OReportModel extends Model ...@@ -280,6 +280,7 @@ class OReportModel extends Model
if (!empty($params['report_agent_phone'])) { if (!empty($params['report_agent_phone'])) {
$conditions[] = "aaa.report_agent_phone LIKE '%".$params['report_agent_phone']."%'"; $conditions[] = "aaa.report_agent_phone LIKE '%".$params['report_agent_phone']."%'";
} }
// 商铺名 // 商铺名
if (!empty($params['house_title'])) { if (!empty($params['house_title'])) {
$conditions[] = "aaa.house_title LIKE '%".$params['house_title']."%'"; $conditions[] = "aaa.house_title LIKE '%".$params['house_title']."%'";
...@@ -289,11 +290,44 @@ class OReportModel extends Model ...@@ -289,11 +290,44 @@ class OReportModel extends Model
$conditions[] = "aaa.user_phone LIKE '%".$params['user_phone']."%'"; $conditions[] = "aaa.user_phone LIKE '%".$params['user_phone']."%'";
} }
if (!empty($params['order_id'])) { if (!empty($params['order_id'])) {
$conditions[] = "aaa.order_id =".$params['order_id']; $conditions[] = "aaa.order_id =".$params['order_id'];
} }
//城市 '省'
if (!empty($params['province'])) {
$conditions[] = "aaa.province = {$params['province']}" ;
}
//城市 '市'
if (!empty($params['city'])) {
$conditions[] = "aaa.city = {$params['city']}" ;
}
//城市 '所在区'
if (!empty($params['disc'])) {
$conditions[] = "aaa.disc = {$params['disc']}" ;
}
//商铺地址
if (!empty($params['internal_address'])) {
$conditions[] = "aaa.internal_address = {$params['internal_address']}" ;
}
//商铺ID
if (!empty($params['house_id'])) {
$conditions[] = "aaa.user_id = {$params['house_id']}" ;
}
//客户ID
if (!empty($params['user_id'])) {
$conditions[] = "aaa.user_id = {$params['user_phone']}" ;
}
#组装搜索where条件 #组装搜索where条件
if ($conditions) { if ($conditions) {
$where_params = 'WHERE ' . implode(" AND ", $conditions); $where_params = 'WHERE ' . implode(" AND ", $conditions);
...@@ -404,12 +438,16 @@ class OReportModel extends Model ...@@ -404,12 +438,16 @@ class OReportModel extends Model
$result = $this->db->query($sql); $result = $this->db->query($sql);
return $result; return $result;
default: default:
$field = "a.id,a.user_id,a.report_agent_name,a.report_agent_phone,a.user_phone,a.user_name,a.predict_see_time,a.create_time,b.id as order_id,b.order_no,b.house_id,b.house_title,c.province,c.city,c.disc,c.internal_address";
$sql = "SELECT * FROM $sql = "SELECT * FROM
((SELECT ((SELECT
$filed $filed
FROM FROM
`o_report` `a` `o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id` LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
LEFT JOIN `g_houses` `c` ON `b`.`house_id` = `c`.`id`
WHERE WHERE
$report_agent_str $report_agent_str
AND `a`.`status` = 0 AND `a`.`status` = 0
...@@ -420,6 +458,7 @@ class OReportModel extends Model ...@@ -420,6 +458,7 @@ class OReportModel extends Model
FROM FROM
`o_report` `a` `o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id` LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
LEFT JOIN `g_houses` `c` ON `b`.`house_id` = `c`.`id`
WHERE WHERE
$house_str $house_str
AND `a`.`status` = 0 AND `a`.`status` = 0
......
<?php
namespace app\model;
use think\Db;
use think\Model;
class UAccountBalance extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_account_balance';
private $db_;
public function __construct($data = [])
{
$this->db_ = Db::table($this->table);
parent::__construct($data);
}
public function addBalance($data)
{
$time = date("Y-m-d H:i:s", time());
$data['create_time'] = $time;
$data['update_time'] = $time;
$data["status"] = 0;
return $this->insert($data);
}
public function getBalanceList($params)
{
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$indexStart = ($pageNo-1) * $pageSize;
$where_str = "";
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$where_str .= " and a.create_time BETWEEN '" . $params['create_time_start'] . " 00:00:00' AND '" . $params['create_time_end'] . " 23:59:59'";
}
if (!empty($params['user_phone'])) {
$where_str .= " and a.user_phone LIKE '%" . $params['user_phone'] . "%'";
}
if (!empty($params['user_id'])) {
$where_str .= " and a.user_id = {$params['user_id']}";
}
$sql = "SELECT * FROM (
( SELECT a.id, a.user_id, a.source_id, a.money,a.user_name, a.create_time, 1 AS is_essay,a.status,c.title,a.user_phone,a.operator_name
FROM `u_account_balance` a left join c_coupon b on a.source_id=b.id
left join c_activity c on b.activity_id=c.id WHERE a.status = 0 and a.source_type = 0 $where_str) UNION
( SELECT a.id, a.user_id,0 as source_id , a.money, a.user_name, a.create_time, 2 AS is_essay,a.status,0 as title,a.user_phone,a.operator_name
FROM `u_account_check` a
WHERE a.status IN ( 0, 1, 2 ) $where_str)
) AS aaa ORDER BY `create_time` DESC LIMIT {$indexStart}, {$pageSize}";
$result = $this->query($sql);
//echo $this->getLastSql();
return $result;
}
/**
* @param $params
* @return int|string
*/
public function getBalanceCount($params)
{
$where_arr = [];
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])){
$where_arr['create_time'] = array('between', array($params['create_time_start'], $params['create_time_end'] . " 23:59:59"));
}
if (!empty($params['user_phone']) ){
$where_arr['user_phone'] = array("like", "%" . trim($params['user_phone']) . "%");
}
if (!empty($params['user_id'])) {
$where_arr['user_id'] = $params['user_id'];
}
$where_arr['status'] = 0;
$result = $this->db_
->field("id")
->where($where_arr)
->count();
return $result;
}
/**
* @param $params
* @return int|string
*/
public function getBalanceTotal($user_id)
{
$where_arr = [];
if (!empty($user_id)) {
$where_arr['user_id'] = $user_id;
}
$where_arr['status'] = 0;
$result = $this->db_
->field("id")
->where($where_arr)
->sum("money");
return $result;
}
}
<?php
namespace app\model;
use think\Db;
use think\Model;
/**
* Created by PhpStorm.
* User: fuju
* Date: 2019/3/14
* Time: 14:13
*/
class UAccountCheck extends Model
{
// 设置当前模型对应的完整数据表名称
protected $table = 'u_account_check';
private $db_;
public function __construct($data = [])
{
$this->db_ = Db::table($this->table);
parent::__construct($data);
}
/**
* @param $params
* @return int|string
*/
public function getCheckCount($params)
{
$where_arr = [];
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$where_arr['create_time'] = array('between', array($params['create_time_start'], $params['create_time_end'] . " 23:59:59"));
}
if (!empty($params['user_phone'])) {
$where_arr['user_phone'] = array("like", "%" . trim($params['user_phone']) . "%");
}
if (!empty($params['user_id'])) {
$where_arr['user_id'] = $params['user_id'];
}
$where_arr['status'] = array("in", "0,1,2");;
$result = $this->db_
->field("id")
->where($where_arr)
->count();
return $result;
}
/**
* @param $params
* @return int|string
*/
public function getCheckTotal($user_id)
{
$where_arr = [];
if (!empty($user_id)) {
$where_arr['user_id'] = $user_id;
}
$where_arr['status'] = array("in", "0,1");;
$result = $this->db_
->field("id")
->where($where_arr)
->sum("money");
return $result;
}
public function addCheck($params)
{
Db::startTrans();
$id = 0;
try {
$id = $this->db_->insertGetId($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
}
return $id;
}
public function updateCheck($id, $params)
{
Db::startTrans();
try {
$this->db_->where('id', $id)->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
Db::rollback();
}
return 0;
}
}
\ No newline at end of file
...@@ -231,6 +231,7 @@ Route::group('index', [ ...@@ -231,6 +231,7 @@ Route::group('index', [
'backOutThree/:check_status' => ['index/Finance/reportList', ['method' => 'get'], ['check_status' => 8]], //财务 成交报告-待撤销-第三级数据 'backOutThree/:check_status' => ['index/Finance/reportList', ['method' => 'get'], ['check_status' => 8]], //财务 成交报告-待撤销-第三级数据
'reportListUndone/:check_status' => ['index/Finance/reportList', ['method' => 'get'], ['check_status' => 6]], //财务 成交报告-已撤销 'reportListUndone/:check_status' => ['index/Finance/reportList', ['method' => 'get'], ['check_status' => 6]], //财务 成交报告-已撤销
'refundList' => ['index/Finance/refundList', ['method' => 'get']], //退款列表-专员审核 'refundList' => ['index/Finance/refundList', ['method' => 'get']], //退款列表-专员审核
'refundListExcel' => ['index/Finance/refundListExcel', ['method' => 'get']], //退款列表-导出excel
'checkReportAttache/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 1]], //审核成交报告-第一级审核 'checkReportAttache/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 1]], //审核成交报告-第一级审核
'checkReportManager/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 2]], //审核成交报告-第二级审核 'checkReportManager/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 2]], //审核成交报告-第二级审核
'checkReportMajordomo/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 3]], //审核成交报告-第三级审核 'checkReportMajordomo/:check_status' => ['index/Finance/checkReport', ['method' => 'post'], ['check_status' => 3]], //审核成交报告-第三级审核
...@@ -245,7 +246,8 @@ Route::group('index', [ ...@@ -245,7 +246,8 @@ Route::group('index', [
'bargainInfo' => ['index/Finance/bargainInfo', ['method' => 'get']], //获取成交报告详情 'bargainInfo' => ['index/Finance/bargainInfo', ['method' => 'get']], //获取成交报告详情
'editBargainInfo' => ['index/Finance/editBargainInfo', ['method' => 'post']], //修改成交报告佣金 'editBargainInfo' => ['index/Finance/editBargainInfo', ['method' => 'post']], //修改成交报告佣金
'addBargain' => ['index/Finance/addBargain', ['method' => 'post']], //新增成交报告佣金(分佣提成) 'addBargain' => ['index/Finance/addBargain', ['method' => 'post']], //新增成交报告佣金(分佣提成)
'commissionList' => ['index/Finance/commissionList', ['method' => 'get']], //成交报告详情-分佣提成 'commissionList' => ['index/Finance/commissionListV2', ['method' => 'get']], //成交报告详情-分佣提成
'checkReferrer' => ['index/Finance/checkReferrer', ['method' => 'get']], //检查是否有邀请人(客户邀请客户)
'payLogList' => ['index/Finance/payLogList', ['method' => 'get']], //收款记录 'payLogList' => ['index/Finance/payLogList', ['method' => 'get']], //收款记录
'phone_up_list' => ['index/remark/phone_up_list', ['method' => 'get|post']], //电话跟进列表 'phone_up_list' => ['index/remark/phone_up_list', ['method' => 'get|post']], //电话跟进列表
'selectReportAll' => ['index/Finance/selectReportAll', ['method' => 'get|post']], //时间轴 'selectReportAll' => ['index/Finance/selectReportAll', ['method' => 'get|post']], //时间轴
...@@ -258,6 +260,7 @@ Route::group('index', [ ...@@ -258,6 +260,7 @@ Route::group('index', [
'getTallAgeList' => ['index/Finance/getTallAgeList', ['method' => 'GET']], //税费承担明细表 'getTallAgeList' => ['index/Finance/getTallAgeList', ['method' => 'GET']], //税费承担明细表
'getCommissionTotalList' => ['index/Finance/getCommissionTotalList', ['method' => 'GET']], //分佣提成汇总表 'getCommissionTotalList' => ['index/Finance/getCommissionTotalList', ['method' => 'GET']], //分佣提成汇总表
'getCollection' => ['index/Finance/getCollection', ['method' => 'post|get']],//收款记录 'getCollection' => ['index/Finance/getCollection', ['method' => 'post|get']],//收款记录
'getCollectionExcel' => ['index/Finance/getCollectionExcel', ['method' => 'post|get']],//收款记录
'addRealMoney' => ['index/Finance/addRealMoney', ['method' => 'post|get']],//新增实收 'addRealMoney' => ['index/Finance/addRealMoney', ['method' => 'post|get']],//新增实收
'visitShop' => ['index/Supervise/visitShop', ['method' => 'get']],//门店拜访 'visitShop' => ['index/Supervise/visitShop', ['method' => 'get']],//门店拜访
'carryOut' => ['index/Supervise/carryOut', ['method' => 'get']],//监督执行 'carryOut' => ['index/Supervise/carryOut', ['method' => 'get']],//监督执行
...@@ -271,7 +274,7 @@ Route::group('index', [ ...@@ -271,7 +274,7 @@ Route::group('index', [
'addReceiptImg' => ['index/Finance/addReceiptImg', ['method' => 'post|get']],//收款图片信息保存 'addReceiptImg' => ['index/Finance/addReceiptImg', ['method' => 'post|get']],//收款图片信息保存
'deleteReceiptImg' => ['index/Finance/deleteReceiptImg', ['method' => 'post|get']],//删除收款图片 'deleteReceiptImg' => ['index/Finance/deleteReceiptImg', ['method' => 'post|get']],//删除收款图片
'receiptImgList' => ['index/Finance/receiptImgList', ['method' => 'post|get']],//收款列表-收款图片列表 'receiptImgList' => ['index/Finance/receiptImgList', ['method' => 'post|get']],//收款列表-收款图片列表
'getCollectionDetail' => ['index/Finance/getCollectionDetail', ['method' => 'post|get']],//收款详情 'getCollectionDetail' => ['index/Finance/getCollectionDetailV2', ['method' => 'post|get']],//收款详情
'getCollectionEdit' => ['index/Finance/getCollectionEdit', ['method' => 'post']],//收款修改保存 'getCollectionEdit' => ['index/Finance/getCollectionEdit', ['method' => 'post']],//收款修改保存
'collectingBill' => ['index/Finance/collectingBill', ['method' => 'post']],//收款 'collectingBill' => ['index/Finance/collectingBill', ['method' => 'post']],//收款
'getBeForNum' => ['index/Finance/getBeForNum', ['method' => 'get']],//getBeForNum 'getBeForNum' => ['index/Finance/getBeForNum', ['method' => 'get']],//getBeForNum
...@@ -304,6 +307,7 @@ Route::group('index', [ ...@@ -304,6 +307,7 @@ Route::group('index', [
'receivables' => ['index/Finance/receivables', ['method' => 'GET']], //获取实收日期 'receivables' => ['index/Finance/receivables', ['method' => 'GET']], //获取实收日期
'adjustment' => ['index/Finance/adjustment', ['method' => 'GET']], //获取实收日期 'adjustment' => ['index/Finance/adjustment', ['method' => 'GET']], //获取实收日期
'getPayLogData' => ['index/Finance/getPayLogData', ['method' => 'GET']], //收款各种详情 'getPayLogData' => ['index/Finance/getPayLogData', ['method' => 'GET']], //收款各种详情
'getActivityCoupon' => ['index/Finance/getActivityCoupon', ['method' => 'GET']], //收款各种详情
'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13 'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13
'marchInList' => [ 'index/MarchIn/marchInList', [ 'method' => 'POST|GET' ] ], //进场记录列表 朱伟 2018-06-13 'marchInList' => [ 'index/MarchIn/marchInList', [ 'method' => 'POST|GET' ] ], //进场记录列表 朱伟 2018-06-13
...@@ -327,8 +331,9 @@ Route::group('index', [ ...@@ -327,8 +331,9 @@ Route::group('index', [
'inspectionRecordList' => [ 'index/InspectionRecord/inspectionRecordList', [ 'method' => 'GET' ] ],//约带看记录liu 'inspectionRecordList' => [ 'index/InspectionRecord/inspectionRecordList', [ 'method' => 'GET' ] ],//约带看记录liu
'realtimePerformance' => [ 'index/RealTimePerformance/realtimePerformanceList', [ 'method' => 'GET' ] ],//实时业绩liu 'realtimePerformance' => [ 'index/RealTimePerformance/realtimePerformanceList', [ 'method' => 'GET' ] ],//实时业绩liu
'shopinspectionLog' => [ 'index/ShopInspectionLog/shopinspectionLogList', [ 'method' => 'POST|GET' ] ],//商铺查看日志liu 'shopinspectionLog' => [ 'index/ShopInspectionLog/shopinspectionLogList', [ 'method' => 'POST|GET' ] ],//商铺查看日志liu
'shopinspectionLogTest' => [ 'index/ShopInspectionLogTest/shopinspectionLogListTest', [ 'method' => 'POST|GET' ] ],//商铺查看日志测试liu 'redEnvelope' => [ 'index/RedEnvelope/redEnvelopeList', [ 'method' => 'POST|GET' ] ],//活动列表liu
'CashBack' => [ 'index/CashBack/cashBackList', [ 'method' => 'POST|GET' ] ],//返现红包liu
'CashAccount' => [ 'index/CashAccount/cashAccountList', [ 'method' => 'POST|GET' ] ],//现金账户liu
'performancesubsidiaryList' => ['index/PerformanceSubsidiary/performancesubsidiaryList', ['method' => 'POST|GET']],//业绩明细liu 'performancesubsidiaryList' => ['index/PerformanceSubsidiary/performancesubsidiaryList', ['method' => 'POST|GET']],//业绩明细liu
'pkList' => ['index/PkList/pkList', ['method' => 'POST|GET']],//pk榜 liu 'pkList' => ['index/PkList/pkList', ['method' => 'POST|GET']],//pk榜 liu
'pkWeekList' => ['index/PkList/pkWeekList', ['method' => 'POST|GET']],//pk榜 liu 'pkWeekList' => ['index/PkList/pkWeekList', ['method' => 'POST|GET']],//pk榜 liu
...@@ -420,6 +425,14 @@ Route::group('index', [ ...@@ -420,6 +425,14 @@ Route::group('index', [
'addUserBind' => [ 'index/member/addUserBind', [ 'method' => 'get|post' ] ], 'addUserBind' => [ 'index/member/addUserBind', [ 'method' => 'get|post' ] ],
'removeUserBind' => [ 'index/member/removeUserBind', [ 'method' => 'get|post' ] ], 'removeUserBind' => [ 'index/member/removeUserBind', [ 'method' => 'get|post' ] ],
'getUserBindHistory' => [ 'index/member/getUserBindHistory', [ 'method' => 'get|post' ] ], 'getUserBindHistory' => [ 'index/member/getUserBindHistory', [ 'method' => 'get|post' ] ],
'saveActivity' => ['index/Activity/saveActivity', ['method' => 'POST|GET']],//新增或修改活动
'getActivityList' => ['index/Activity/getActivityList', ['method' => 'POST|GET']],//获取活动
'couponList' => ['index/Coupon/couponList', ['method' => 'GET']],//获取活动
'userAccountBalanceList' => ['index/AccountBalance/userAccountBalanceList', ['method' => 'get|post']],
'check' => ['index/AccountBalance/check', ['method' => 'get|post']],
]); ]);
...@@ -429,12 +442,11 @@ Route::group('api', [ ...@@ -429,12 +442,11 @@ Route::group('api', [
'sendSms' => ['api/member/sendSms', ['method' => 'get']], //发送短信 'sendSms' => ['api/member/sendSms', ['method' => 'get']], //发送短信
'check_code' => ['api/member/check_code', ['method' => 'get']], //检测短信 'check_code' => ['api/member/check_code', ['method' => 'get']], //检测短信
'index' => ['api/member/index', ['method' => 'get']], 'index' => ['api/member/index', ['method' => 'get']],
'getHomeCoupon' => ['api/Coupon/getHomeCoupon', ['method' => 'get']],
'couponList' => ['api/Coupon/couponList', ['method' => 'get']], //返现红包列表
//get broker
'getBroker' => ['api/broker/index', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表 'getBroker' => ['api/broker/index', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'getBrokerV2' => ['api/broker/indexV2', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表 'getBrokerV2' => ['api/broker/indexV2', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'test' => ['api/broker/testtest', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表 // 'test' => ['api/broker/testtest', ['method' => 'get']], //获取当前商铺或街铺的经纪人评论信息列表
'commentAndDeal' => ['api/broker/commentAndDeal', ['method' => 'get']], //获取当前经纪人的评价和交易列表 'commentAndDeal' => ['api/broker/commentAndDeal', ['method' => 'get']], //获取当前经纪人的评价和交易列表
'brokerDetail' => ['api/broker/brokerDetail', ['method' => 'get']], //经纪人详情 'brokerDetail' => ['api/broker/brokerDetail', ['method' => 'get']], //经纪人详情
//post broker //post broker
...@@ -512,6 +524,11 @@ Route::group('api', [ ...@@ -512,6 +524,11 @@ Route::group('api', [
'addUserCallAgentV2' => ['api/CallAgent/addUserCallAgentV2', ['method' => 'POST|GET']],//客户来电记录h5 'addUserCallAgentV2' => ['api/CallAgent/addUserCallAgentV2', ['method' => 'POST|GET']],//客户来电记录h5
'userAccountBalanceList' => ['api/AccountBalance/userAccountBalanceList', ['method' => 'get|post']],//
'totalAccount' => ['api/AccountBalance/totalAccount', ['method' => 'post']],
'applyForWithdraw' => ['api/AccountBalance/applyForWithdraw', ['method' => 'post']],
]); ]);
Route::group('chat', [ Route::group('chat', [
...@@ -583,6 +600,12 @@ Route::group('task', [ ...@@ -583,6 +600,12 @@ Route::group('task', [
'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']], 'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']],
'frostAgent' => ['task/FrostAgentTask/frostAgent', ['method' => 'get']], 'frostAgent' => ['task/FrostAgentTask/frostAgent', ['method' => 'get']],
'updateActivityStatus' => ['task/UpdateActivityTask/updateActivityStatus', ['method' => 'get']],
'updateForActivityBegins' => ['task/UpdateActivityTask/updateForActivityBegins', ['method' => 'get']],
'updateCouponExpired' => ['task/UpdateCouponTask/updateCouponExpired', ['method' => 'get']],//超过有效期的券改过期
]); ]);
Route::group('broker', [ Route::group('broker', [
......
...@@ -202,12 +202,18 @@ class PrivacyNumber ...@@ -202,12 +202,18 @@ class PrivacyNumber
$file_name = explode('/', $v['voice_file']); $file_name = explode('/', $v['voice_file']);
$file_name = $file_name[1]; $file_name = $file_name[1];
} }
$is_down = down_file($result_data->DownloadUrl, PHONE_VOICE, $file_name); $is_down = down_file($result_data->DownloadUrl, PHONE_VOICE, $file_name, $date);
} }
} elseif ($v['type'] == 2) { } elseif ($v['type'] == 2) {
/*容联云音频下载*/ /*容联云音频下载*/
if (!empty($v['mp3_url'])) { if (!empty($v['mp3_url'])) {
$is_down = down_file($v['mp3_url'], PHONE_VOICE); if ($param['record_down'] == 1) {
$file_name = basename($v['mp3_url']);
} else {
$file_name = explode('/', $v['voice_file']);
$file_name = $file_name[1];
}
$is_down = down_file($v['mp3_url'], PHONE_VOICE, $file_name, $date);
} }
} }
......
<?php
namespace app\task\controller;
use app\model\CActivity;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2019/3/8
* Time: 4:53 PM
*/
class UpdateActivityTask
{
private $m_active;
function __construct()
{
$this->m_active = new CActivity();
}
/**
* 对活动列表筛查,到预定时间的开启活动
*/
public function updateForActivityBegins()
{
$field = 'id,activity_start_time';
$params['status'] = 5;
$active_list = $this->m_active->getActivity($field,$params);
if(!$active_list){
exit;
}
foreach ($active_list as $k => $v) {
if(!$v['activity_start_time']){
continue;
}
#结束时间小于当时前时间
if( $v['activity_start_time'] < date("Y-m-d H:i:s", time())){
$this->m_active->editorActivity($v['id'],['status' => 0]);
continue;
}
}
exit;
}
/**
* 对活动列表筛查,设置过期领完
*/
public function updateActivityStatus()
{
//新增数据
// $insert["title"] = '测试活动';//活动名称
// $insert["return_type"] = 0;//奖励类型,0返现红包 1现金
// $insert["money"] = 500;//奖励金额
// $insert["return_action"] = 0;//奖励动作 0首次登陆 1邀请登陆 2邀请成交
// $insert["activity_start_time"] = '2019-03-08 15:36:35';//活动开始时间
// $insert["activity_end_time"] = '2019-04-08 15:36:40';//活动结束时间
// $insert["use_period"] = 30;//使用有效期针对返现红包 天数 -1代表不限时间
// $insert["total"] = 1000;//可发放总数 -1表示不限
// $insert["available"] = 1000;//用户可领数 -1表示不限
// $insert["get_number"] = 500;//已领取数量
// $insert["activity_rule"] = '测试活动规则';//活动规则
// $insert["status"] = 0;//状态 0正常 1手动停止 2数量为空 3时间过期 4删除 5未开始
//
// $res = $this->m_active->addActivity($insert);//int(1)
$field = 'id,activity_start_time,activity_end_time,available,get_number,status';
$active_list = $this->m_active->getActivity($field,[]);
if(!$active_list){
exit;
}
foreach ($active_list as $k => $v) {
if(!$v['activity_start_time'] or !$v['activity_end_time'] or !is_numeric($v['available']) or !is_numeric($v['get_number'])){
continue;
}
#开始时间大于当时前时间
if( $v['activity_start_time'] > date("Y-m-d H:i:s", time())){
$this->m_active->editorActivity($v['id'],['status' => 5]);
continue;
}
#结束时间小于当时前时间
if( $v['activity_end_time'] < date("Y-m-d H:i:s", time())){
$this->m_active->editorActivity($v['id'],['status' => 3]);
continue;
}
}
exit;
}
}
\ No newline at end of file
<?php
namespace app\task\controller;
use app\model\CCoupon;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2019/3/8
* Time: 4:53 PM
*/
class UpdateCouponTask
{
private $m_coupon;
function __construct()
{
$this->m_coupon = new CCoupon();
}
/**
* 超过有效期的券改过期
*/
public function updateCouponExpired()
{
$field = 'a.id,a.activity_id,a.create_time,b.money,b.use_period';
$params['a.status'] = 0;
$coupon_list = $this->m_coupon->getCouponJoinActivity($field,$params);
if(!$coupon_list){
exit;
}
// 循环查看是否过期
foreach ($coupon_list as $k => $v) {
if($v['use_period']<0){
continue;
}
#发券日期大于最后使用日期
if( $v['create_time'] > date("Y-m-d H:i:s", strtotime("+{$v['use_period']} day",strtotime($v['use_period'])))){
$this->m_coupon->updateStatus($v['id'],2);
}
}
exit;
}
}
\ No newline at end of file
...@@ -23,4 +23,4 @@ ...@@ -23,4 +23,4 @@
if(!doc.addEventListener) return; if(!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false); win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false); doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);</script><link href=./static/css/app.114859684c94a19f75437a9f4ca158c8.css rel=stylesheet></head><body><div id=app></div><script src=https://api.tonglianjituan.com/app/js/libs/vue.min.js></script><script src=https://api.tonglianjituan.com/app/js/libs/vue-router.min.js></script><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1b35a927314506fe4a4f.js></script><script type=text/javascript src=./static/js/app.2cb278bd36009512e8d4.js></script></body></html> })(document, window);</script><link href=./static/css/app.fb0495c45d8e8f4a215b24c757e3a74d.css rel=stylesheet></head><body><div id=app></div><script src=https://api.tonglianjituan.com/app/js/libs/vue.min.js></script><script src=https://api.tonglianjituan.com/app/js/libs/vue-router.min.js></script><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.1b35a927314506fe4a4f.js></script><script type=text/javascript src=./static/js/app.ea8ef220e6c195a1a4bc.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment