Compare commits
97 Commits
Author | SHA1 | Date | |
---|---|---|---|
c2b3591cb8 | |||
bc3aeece29 | |||
14e57cf160 | |||
6309728f42 | |||
92875784d8 | |||
1731aced5b | |||
5699b7caab | |||
445504d83b | |||
0466f2f43e | |||
f04c2452c3 | |||
92236b085a | |||
216ce5b3a2 | |||
fc35332d22 | |||
03b7bca65f | |||
41b2e03706 | |||
9f4be69e82 | |||
c88d4363dd | |||
502dc6bb70 | |||
f4ac4a7502 | |||
f05f50f50f | |||
4d3f38d339 | |||
837ec1bdd4 | |||
e18c9b1caf | |||
6a1fb14192 | |||
2877d9f095 | |||
218c48ed7a | |||
67e5f0214b | |||
5de38a5258 | |||
4db9b0ca57 | |||
aec5856ba8 | |||
01971c82c2 | |||
5e8f4bffac | |||
e5caca3e10 | |||
3d803b61d6 | |||
|
517bc84dd1 | ||
b62fa2ab5e | |||
8bb95381bb | |||
7a103348c7 | |||
15a9db8e6e | |||
0a13418fd4 | |||
|
4991aa6347 | ||
c482d518e0 | |||
33b64c6955 | |||
ea9079d94b | |||
93ff2aa9e5 | |||
3a5222f11c | |||
f15526ec60 | |||
9d3b8e40ff | |||
a5aad9b168 | |||
1d8973015d | |||
8182912f99 | |||
f39930c12e | |||
a59aa60d55 | |||
50554c06ff | |||
763ef9e96d | |||
f8ff5dfacf | |||
05cc0b74d3 | |||
0fba8ea690 | |||
cede6f3943 | |||
7f330fe4f2 | |||
82d910a729 | |||
9f5c823df3 | |||
a984171a03 | |||
f9be35da6d | |||
1a67da716e | |||
7b68573b2b | |||
32aaebbffc | |||
b11f459671 | |||
70f60d11df | |||
18e188e958 | |||
0ac236a619 | |||
b7d6b0ed8d | |||
f12ef7f39d | |||
49203e1d7a | |||
35ae88919c | |||
841ce33eb8 | |||
209a90d585 | |||
03627bcc3e | |||
2da6de113e | |||
ab20a32c1e | |||
62f9a63757 | |||
896d91a0e3 | |||
6b46eeb702 | |||
9ec7571322 | |||
a74be37753 | |||
d22116f160 | |||
350b5f8aaf | |||
f9051bbc0f | |||
8a6a46b116 | |||
56ac22e87b | |||
a9ececba5e | |||
b0c4e09ebf | |||
fc5c7ad32b | |||
312790a635 | |||
fadce0e804 | |||
|
bc4ff82edf | ||
|
f40be77788 |
BIN
H5436787D.wgt
BIN
H5436787D.wgt
Binary file not shown.
BIN
app-release.apk
BIN
app-release.apk
Binary file not shown.
@ -1,5 +0,0 @@
|
|||||||
<?php
|
|
||||||
$data['show']=0;
|
|
||||||
$data['img'][0] = ['src'=>'http://img.juzi199.com/static/app2/img/startup_1.jpg','href'=>''];
|
|
||||||
$data['img'][1] = ['src'=>'http://img.juzi199.com/static/app2/img/startup_1.jpg','href'=>''];
|
|
||||||
exit(json_encode($data));
|
|
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
$data['version'] = 90;
|
$data['version'] = 100;
|
||||||
$data['ios_must_update'] = 1; //是否强制更新,0不强制,1强制
|
$data['ios_must_update'] = 1; //是否强制更新,0不强制,1强制
|
||||||
$data['must_update'] = 1; //是否强制更新,0不强制,1强制
|
$data['must_update'] = 1; //是否强制更新,0不强制,1强制
|
||||||
$data['apk_version'] = '2.4.1';
|
$data['apk_version'] = '2.5.2';
|
||||||
$data['apk_down_url'] = 'http://www.zgqlg.com.cn/H5436787D.wgt';
|
$data['apk_down_url'] = 'http://www.zgqlg.com.cn/H5436787D.wgt';
|
||||||
//$data['ios_version'] = '1.0.0';
|
//$data['ios_version'] = '1.0.0';
|
||||||
$data['ios_appid'] = '1355322179';
|
$data['ios_appid'] = '1355322179';
|
||||||
|
@ -187,7 +187,7 @@ class Platform extends Base{
|
|||||||
$map['createTime'] =array('egt',$end_date);
|
$map['createTime'] =array('egt',$end_date);
|
||||||
}
|
}
|
||||||
switch ($dataType) {
|
switch ($dataType) {
|
||||||
case 1://预获产品券
|
case 1://购物股
|
||||||
$result['num'] = $m->getSum(array_merge($where,['moneyType'=>1]),'expectedProductNum');
|
$result['num'] = $m->getSum(array_merge($where,['moneyType'=>1]),'expectedProductNum');
|
||||||
$result['num'] -= $m->getSum(array_merge($where,['moneyType'=>0]),'expectedProductNum');
|
$result['num'] -= $m->getSum(array_merge($where,['moneyType'=>0]),'expectedProductNum');
|
||||||
break;
|
break;
|
||||||
|
@ -314,6 +314,11 @@ class CashDraws extends Base{
|
|||||||
// $user->save();
|
// $user->save();
|
||||||
|
|
||||||
$targetId = $user->userId;
|
$targetId = $user->userId;
|
||||||
|
if (isset($user['userName'])) $displayName = $user['userName'];
|
||||||
|
else {
|
||||||
|
\think\Log::write("CASH_DRAW_USERNAME_ISNOT_SET");
|
||||||
|
$displayName = $cash->targetId;
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
@ -326,6 +331,11 @@ class CashDraws extends Base{
|
|||||||
// $shop->save();
|
// $shop->save();
|
||||||
|
|
||||||
$targetId = $shop->userId;
|
$targetId = $shop->userId;
|
||||||
|
if (isset($shop['userName'])) $displayName = $shop['userName'];
|
||||||
|
else {
|
||||||
|
\think\Log::write("CASH_DRAW_SHOP_USERNAME_ISNOT_SET");
|
||||||
|
$displayName = $cash->targetId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +361,11 @@ class CashDraws extends Base{
|
|||||||
|
|
||||||
$lm['dataSrc'] = 3;
|
$lm['dataSrc'] = 3;
|
||||||
|
|
||||||
$lm['remark'] = '提现申请单【'.$cash->cashNo.'】申请提现¥'.$cash->money.'。'.(($cash->cashRemarks!='')?"【操作备注】:".$cash->cashRemarks:'');
|
if ($cash->targetType == 0) {
|
||||||
|
$lm['remark'] = '提现申请单【'.$cash->cashNo.'】提现'.(($cash->cashRemarks!='')?"。【操作备注】:".$cash->cashRemarks:'');
|
||||||
|
} else {
|
||||||
|
$lm['remark'] = '商户【'.$displayName.'】提现'.(($cash->cashRemarks!='')?"。【操作备注】:".$cash->cashRemarks:'');
|
||||||
|
}
|
||||||
|
|
||||||
$lm['moneyType'] = 0;
|
$lm['moneyType'] = 0;
|
||||||
|
|
||||||
@ -362,8 +376,11 @@ class CashDraws extends Base{
|
|||||||
$lm['createTime'] = date('Y-m-d H:i:s');
|
$lm['createTime'] = date('Y-m-d H:i:s');
|
||||||
|
|
||||||
model('LogMoneys')->insert($lm);
|
model('LogMoneys')->insert($lm);
|
||||||
|
//
|
||||||
|
Model('common/LogMoneys')->addMoneyLog(1, $cash->targetId,$id,4,'商户【'.$displayName.'】支出',
|
||||||
|
0,$cash->money,'qlgpay',3);
|
||||||
|
|
||||||
//发送信息信息
|
//发送信息信息
|
||||||
|
|
||||||
$tpl = WSTMsgTemplates('CASH_DRAW_SUCCESS');
|
$tpl = WSTMsgTemplates('CASH_DRAW_SUCCESS');
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ class Users extends Base{
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try{
|
try{
|
||||||
switch ($rechargeCurrency) {
|
switch ($rechargeCurrency) {
|
||||||
case 1://预获产品券
|
case 1://购物股
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($userId,0,$rechargeNum,0,'系统'.$rechargeNames[$rechargeType],$rechargeType);
|
Model('common/UserVouchers')->insertVouchersNotice($userId,0,$rechargeNum,0,'系统'.$rechargeNames[$rechargeType],$rechargeType);
|
||||||
break;
|
break;
|
||||||
case 2://预获优惠券
|
case 2://预获优惠券
|
||||||
|
@ -4,7 +4,7 @@ function initGrid(){
|
|||||||
var cols = [
|
var cols = [
|
||||||
{title:'类型', name:'type' ,width:200,renderer: function(val,item,rowIndex){
|
{title:'类型', name:'type' ,width:200,renderer: function(val,item,rowIndex){
|
||||||
if(val == 1) return '代快付';
|
if(val == 1) return '代快付';
|
||||||
else return '代慢付'
|
else return '助购值'
|
||||||
}},
|
}},
|
||||||
{title:'金额', name:'num' ,width:200,renderer: function(val,item,rowIndex){
|
{title:'金额', name:'num' ,width:200,renderer: function(val,item,rowIndex){
|
||||||
if(item.changeType!=1){
|
if(item.changeType!=1){
|
||||||
|
@ -4,7 +4,7 @@ function initGrid(){
|
|||||||
var cols = [
|
var cols = [
|
||||||
{title:'类型', name:'type' ,width:200,renderer: function(val,item,rowIndex){
|
{title:'类型', name:'type' ,width:200,renderer: function(val,item,rowIndex){
|
||||||
if(val == 1) return '代快付';
|
if(val == 1) return '代快付';
|
||||||
else return '代慢付'
|
else return '助购值'
|
||||||
}},
|
}},
|
||||||
{title:'金额', name:'num' ,width:200,renderer: function(val,item,rowIndex){
|
{title:'金额', name:'num' ,width:200,renderer: function(val,item,rowIndex){
|
||||||
if(item.changeType!=1){
|
if(item.changeType!=1){
|
||||||
|
@ -47,7 +47,8 @@ function enterLicense(){
|
|||||||
<div class="img"><img src="__ADMIN__/img/14.png"/></div>
|
<div class="img"><img src="__ADMIN__/img/14.png"/></div>
|
||||||
<div class="data">
|
<div class="data">
|
||||||
<p class="data-top" style="color: #fabd3a;;">{$object['qlg']['slowPay']}</p>
|
<p class="data-top" style="color: #fabd3a;;">{$object['qlg']['slowPay']}</p>
|
||||||
<div class="data-bottom">代慢付值</div>
|
<div class="data-bottom">助购值</div>
|
||||||
|
<!-- <div class="data-bottom">代慢付值</div>-->
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -109,10 +109,36 @@ class Auth extends Base{
|
|||||||
unset($data['authId']);
|
unset($data['authId']);
|
||||||
unset($data['mobileCode']);
|
unset($data['mobileCode']);
|
||||||
unset($data['isCompany']);
|
unset($data['isCompany']);
|
||||||
unset($data['payPwd']);
|
unset($data['payPwd']);
|
||||||
|
$apm = new M();
|
||||||
|
$apm->setTable('auth_personal');
|
||||||
if($isUpdate){
|
if($isUpdate){
|
||||||
|
if (isset($data['householdIdCard']) && isset($data['householdName'])) {
|
||||||
|
try{
|
||||||
|
if ($apm->where('id', '<>', $authId)->where('householdIdCard', '=', $data['householdIdCard'])->count()>0) {
|
||||||
|
exit(jsonReturn('友情提示:您好:已有同身份证号用户注册我商城,请联系您的家人查询“用户名”和相关密码。'));
|
||||||
|
}
|
||||||
|
if ($apm->where('id', '<>', $authId)->where('householdName', '=', $data['householdName'])->count()>0) {
|
||||||
|
exit(jsonReturn('友情提示:您好:已有同姓名注册我商城,请联系您的家人查询“用户名”和相关密码。'));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
errLog($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
$isSuccess = $m->updateInfo(['id'=>$authId],$data);
|
$isSuccess = $m->updateInfo(['id'=>$authId],$data);
|
||||||
}else{
|
}else{
|
||||||
|
if (isset($data['householdIdCard']) && isset($data['householdName'])) {
|
||||||
|
try{
|
||||||
|
if ($apm->where('householdIdCard', '=', $data['householdIdCard'])->count()>0) {
|
||||||
|
exit(jsonReturn('友情提示:您好:已有同身份证号用户注册我商城,请联系您的家人查询“用户名”和相关密码。'));
|
||||||
|
}
|
||||||
|
if ($apm->where('householdName', '=', $data['householdName'])->count()>0) {
|
||||||
|
exit(jsonReturn('友情提示:您好:已有同姓名注册我商城,请联系您的家人查询“用户名”和相关密码。'));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
errLog($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
$isSuccess = $m->insertInfo($data);
|
$isSuccess = $m->insertInfo($data);
|
||||||
}
|
}
|
||||||
if(false !== $isSuccess){
|
if(false !== $isSuccess){
|
||||||
|
@ -17,7 +17,10 @@ class Index extends Base{
|
|||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function startGiveVouchers(){
|
public function startGiveVouchers(){
|
||||||
Model('UserVouchers')->startGiveVouchers();
|
return Model('UserVouchers')->startGiveVouchers();
|
||||||
|
}
|
||||||
|
public function startRevokeVouchers(){
|
||||||
|
return Model('UserVouchers')->startRevokeVouchers();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
|
@ -35,6 +35,33 @@ class UserLevel extends Base
|
|||||||
return $User;
|
return $User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function stats()
|
||||||
|
{
|
||||||
|
$userId = get_my_id();
|
||||||
|
$goodsType = 3;
|
||||||
|
$sm = Model('common/SysSummary');
|
||||||
|
$sysData= $sm->getInfo('toPaySlow');
|
||||||
|
$helpSaleNum = Db::name('orders')->where(compact('userId','goodsType'))->where('payable', '>',0)->sum('payable');
|
||||||
|
$zgTimes = Db::name('orders')->where(compact('userId','goodsType'))->count();
|
||||||
|
$zgTimes += 1;
|
||||||
|
$helpSaleNum += 1;
|
||||||
|
$helpSaleNum = number_format($helpSaleNum, 2, '.', '');
|
||||||
|
return [
|
||||||
|
'zgTimes'=>$zgTimes,
|
||||||
|
'myZgA'=>$helpSaleNum,
|
||||||
|
'zgAmounts'=>$sysData['toPaySlow'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stats2()
|
||||||
|
{
|
||||||
|
$userId = get_my_id();
|
||||||
|
$goodsType = 3;
|
||||||
|
return [
|
||||||
|
'zgAmounts'=>Db::name('orders')->where(compact('userId','goodsType'))->sum('helpGetCount'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TreeList
|
* TreeList
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
@ -64,7 +91,6 @@ class UserLevel extends Base
|
|||||||
$treeArr[$newLevel]['userId'] = $userId;
|
$treeArr[$newLevel]['userId'] = $userId;
|
||||||
$treeArr[$newLevel]['userName'] = '';
|
$treeArr[$newLevel]['userName'] = '';
|
||||||
}else{$newLevel--;}
|
}else{$newLevel--;}
|
||||||
if ($userId <= 1)break;
|
|
||||||
} while (($newLevel <= $max) && ($newLevel <= (int)dataConf("helpSaleMaxLevel")));
|
} while (($newLevel <= $max) && ($newLevel <= (int)dataConf("helpSaleMaxLevel")));
|
||||||
// pd($treeArr);
|
// pd($treeArr);
|
||||||
return $treeArr;
|
return $treeArr;
|
||||||
|
@ -4,6 +4,7 @@ use think\Db;
|
|||||||
use wstmart\app\model\Users as M;
|
use wstmart\app\model\Users as M;
|
||||||
use wstmart\app\model\Favorites;
|
use wstmart\app\model\Favorites;
|
||||||
use wstmart\app\model\Messages;
|
use wstmart\app\model\Messages;
|
||||||
|
use wstmart\common\model\AuthFamily as FM;
|
||||||
use wstmart\common\model\LogSms;
|
use wstmart\common\model\LogSms;
|
||||||
use wstmart\common\model\Users as MUsers;
|
use wstmart\common\model\Users as MUsers;
|
||||||
use wstmart\common\model\UserTrees;
|
use wstmart\common\model\UserTrees;
|
||||||
@ -16,7 +17,7 @@ class Users extends Base{
|
|||||||
|
|
||||||
// 前置方法执行列表
|
// 前置方法执行列表
|
||||||
protected $beforeActionList = [
|
protected $beforeActionList = [
|
||||||
'checkAuth' => ['except'=>'checklogin,login,check_login_name,get_puser_info,register,getverify,toregister,forgetpass,forgetpasst,forgetpasss,forgetpassf,findpass,getfindphone,resetpass,getphoneverifycode,checkuserphone']// 访问这些except下的方法不需要执行前置操作
|
'checkAuth' => ['except'=>'checklogin,check_real_no,login,check_login_name,check_real_name,get_puser_info,register,getverify,toregister,forgetpass,forgetpasst,forgetpasss,forgetpassf,findpass,getfindphone,resetpass,getphoneverifycode,checkuserphone']// 访问这些except下的方法不需要执行前置操作
|
||||||
];
|
];
|
||||||
/**
|
/**
|
||||||
* 我的亲人投资列表
|
* 我的亲人投资列表
|
||||||
@ -82,6 +83,24 @@ class Users extends Base{
|
|||||||
}
|
}
|
||||||
exit(json_encode(WSTCheckLoginKey($loginName)));
|
exit(json_encode(WSTCheckLoginKey($loginName)));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 检测会员名
|
||||||
|
*/
|
||||||
|
public function check_real_name(){
|
||||||
|
$loginName = input('post.householdName');
|
||||||
|
exit(json_encode(WSTCheckLoginKey2($loginName)));
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 检测会员名
|
||||||
|
*/
|
||||||
|
public function check_real_no(){
|
||||||
|
$loginName = input('post.householdIdCard');
|
||||||
|
$fm = new FM();
|
||||||
|
if($fm->getInfo(['familyIdCard'=>$loginName],'id')){
|
||||||
|
exit(jsonReturn('友情提示:您好:已有同身份证用户注册我商城,请联系您的家人查询“用户名”和相关密码。'));
|
||||||
|
}
|
||||||
|
return WSTReturn("该登录账号可用",1);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 获取券值
|
* 获取券值
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
|
@ -9,7 +9,7 @@ use wstmart\admin\model\CashDraws as CM;
|
|||||||
class Uservouchers extends Base{
|
class Uservouchers extends Base{
|
||||||
// 前置方法执行列表
|
// 前置方法执行列表
|
||||||
protected $beforeActionList = [
|
protected $beforeActionList = [
|
||||||
'checkAuth' => ['except'=>'startgivevouchers,savedaymoney']// 访问这些except下的方法不需要执行前置操作
|
'checkAuth' => ['except'=>'startgivevouchers,savedaymoney','startRevokeVouchers']// 访问这些except下的方法不需要执行前置操作
|
||||||
];
|
];
|
||||||
/**
|
/**
|
||||||
* 保存每日券值
|
* 保存每日券值
|
||||||
@ -25,7 +25,10 @@ class Uservouchers extends Base{
|
|||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function startGiveVouchers(){
|
public function startGiveVouchers(){
|
||||||
Model('UserVouchers')->startGiveVouchers();
|
return Model('UserVouchers')->startGiveVouchers();
|
||||||
|
}
|
||||||
|
public function startRevokeVouchers(){
|
||||||
|
return Model('UserVouchers')->startRevokeVouchers();
|
||||||
}
|
}
|
||||||
//获取券值
|
//获取券值
|
||||||
public function getVouchers(){
|
public function getVouchers(){
|
||||||
|
@ -371,12 +371,41 @@ function WSTCheckLoginKey($val,$userId = 0){
|
|||||||
if(!WSTCheckFilterWords($val,WSTConf("CONF.registerLimitWords"))){
|
if(!WSTCheckFilterWords($val,WSTConf("CONF.registerLimitWords"))){
|
||||||
return WSTReturn("登录账号包含非法字符");
|
return WSTReturn("登录账号包含非法字符");
|
||||||
}
|
}
|
||||||
$dbo = Db::name('users')->where(["loginName|userPhone"=>['=',$val]]);
|
$dbo = Db::name('users')->where(["userPhone"=>['=',$val]]);
|
||||||
|
$dbo2 = Db::name('users')->where(["loginName"=>['=',$val]]);
|
||||||
|
if($userId>0){
|
||||||
|
$dbo->where("userId", "<>", $userId);
|
||||||
|
$dbo2->where("userId", "<>", $userId);
|
||||||
|
}
|
||||||
|
if($dbo->find()){
|
||||||
|
return WSTReturn("友情提示:您好:该手机号已注册");
|
||||||
|
}
|
||||||
|
if($dbo2->find()){
|
||||||
|
return WSTReturn("友情提示:您好:已有同姓名注册我商城,请核实您是否早已注册。");
|
||||||
|
}
|
||||||
|
return WSTReturn("该登录账号可用",1);
|
||||||
|
|
||||||
|
// $rs = $dbo->count();
|
||||||
|
// if($rs==0){
|
||||||
|
// $lm_info = getLMUserByName($val);//获取联盟会员信息
|
||||||
|
// if($lm_info){
|
||||||
|
// return WSTReturn("该登录账号已注册联盟用户");
|
||||||
|
// }
|
||||||
|
// return WSTReturn("该登录账号可用",1);
|
||||||
|
// }
|
||||||
|
// return WSTReturn("对不起,登录账号已存在");
|
||||||
|
}
|
||||||
|
function WSTCheckLoginKey2($val,$userId = 0){
|
||||||
|
if($val=='')return WSTReturn("户主姓名不能为空");
|
||||||
|
if(!WSTCheckFilterWords($val,WSTConf("CONF.registerLimitWords"))){
|
||||||
|
return WSTReturn("户主姓名包含非法字符");
|
||||||
|
}
|
||||||
|
$dbo = Db::name('auth_personal')->where(["householdName"=>['=',$val]]);
|
||||||
if($userId>0){
|
if($userId>0){
|
||||||
$dbo->where("userId", "<>", $userId);
|
$dbo->where("userId", "<>", $userId);
|
||||||
}
|
}
|
||||||
if($dbo->find()){
|
if($dbo->find()){
|
||||||
return WSTReturn("友情提示:您好:该用户名已注册");
|
return WSTReturn("友情提示:您好:已有同姓名注册我商城,请核实您的户主是否早已注册。");
|
||||||
}
|
}
|
||||||
return WSTReturn("该登录账号可用",1);
|
return WSTReturn("该登录账号可用",1);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ return [
|
|||||||
// | 应用设置
|
// | 应用设置
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
// 应用调试模式
|
// 应用调试模式
|
||||||
'app_debug' => true,
|
'app_debug' => false,
|
||||||
// 应用Trace
|
// 应用Trace
|
||||||
'app_trace' => false,
|
'app_trace' => false,
|
||||||
// 应用模式状态
|
// 应用模式状态
|
||||||
|
@ -118,7 +118,7 @@ class CashDraws extends Base{
|
|||||||
$user = model('users')->get($userId);
|
$user = model('users')->get($userId);
|
||||||
$payPwd = md5($payPwd.$user->loginSecret);
|
$payPwd = md5($payPwd.$user->loginSecret);
|
||||||
if($payPwd!=$user->payPwd)return WSTReturn('操作密码错误');
|
if($payPwd!=$user->payPwd)return WSTReturn('操作密码错误');
|
||||||
if($money>$user->wangNum)return WSTReturn('提取金额不能大于商家的已获旺旺券额');
|
if($money>$user->wangNum)return WSTReturn('提取金额不能大于商家的售物券额');
|
||||||
//减去要提取的金额
|
//减去要提取的金额
|
||||||
$user->wangNum = $user->wangNum-$money;
|
$user->wangNum = $user->wangNum-$money;
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
|
@ -1438,7 +1438,7 @@ class Orders extends Base{
|
|||||||
}
|
}
|
||||||
$order = $this->alias('o')->join('__SHOPS__ s','o.shopId=s.shopId','left')
|
$order = $this->alias('o')->join('__SHOPS__ s','o.shopId=s.shopId','left')
|
||||||
->where(['o.userId'=>$userId,'o.orderId'=>$orderId,'o.orderStatus'=>1])
|
->where(['o.userId'=>$userId,'o.orderId'=>$orderId,'o.orderStatus'=>1])
|
||||||
->field('o.orderId,o.orderNo,o.helpUserId,o.helpUserLevel,o.payType,s.userId,s.shopId,s.userId as sUserId,o.orderScore,o.payFrom,o.goodsMoney,o.realTotalMoney,o.goodsType,commissionFee')->find();
|
->field('o.orderId,o.orderNo,o.helpUserId,o.helpUserLevel,o.payType,s.userId,s.shopId,s.userId as sUserId,o.orderScore,o.payFrom,o.goodsMoney,o.realTotalMoney,o.goodsType,commissionFee,o.createTime as ctime')->find();
|
||||||
if(!empty($order)){
|
if(!empty($order)){
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try{
|
try{
|
||||||
@ -1519,62 +1519,149 @@ class Orders extends Base{
|
|||||||
|
|
||||||
$vm = new UserVouchers();
|
$vm = new UserVouchers();
|
||||||
|
|
||||||
|
$zgSwipeUseReal = dataConf('zgSwipeUseReal') != 0;
|
||||||
|
$zgSwipeUnless = floatval(dataConf('zgSwipeUnless'));
|
||||||
// step 5 平台送自己:10000×N“助购预获”,
|
$zgSwipeToLevel = (int)$order['helpUserLevel'];
|
||||||
// 10000“预获产品券”;
|
// 确认是否滑动
|
||||||
// 10000×0.4×0.5×0.5=1000“预获优惠券”。
|
$isZgSwipe = false;
|
||||||
if ((int)$order["helpUserLevel"] === 1) {
|
if ($zgSwipeUnless < 0) $zgSwipeUnless = 0;
|
||||||
$vm->insertHelpSaleNotice($userId, $orderId, $order['goodsMoney']*((int)$order["helpUserLevel"]),
|
$curZgSwipeTo = $order['helpUserId'];
|
||||||
'交易订单【'.$order['orderNo'].'】购户购物所得', 1);
|
// 初始层级必须大于0
|
||||||
} else {
|
if ($zgSwipeToLevel > 0) {
|
||||||
$vm->insertHelpSaleNotice($userId, $orderId, $order['goodsMoney']*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"),
|
// 用户ID是1或者0,不滑动了
|
||||||
'交易订单【'.$order['orderNo'].'】购户购物所得', 1);
|
if ($order['helpUserId'] != 1 && $order['helpUserId'] != 0) {
|
||||||
}
|
$helpSaleInfo = Db::name("user_vouchers_summary")->where(['userId'=>$curZgSwipeTo])->find();
|
||||||
|
if($helpSaleInfo===null){$userHelpGet=0;}
|
||||||
// step 8 平台送自己的上第N层:扣减“助购预获”、“预获产品券”各10000×0.4×0.5=2000,
|
else{$userHelpGet = (float)$helpSaleInfo['helpSaleNum'];}
|
||||||
// 同时添加10000×0.4×0.5=2000“已获产品券”。
|
while ($userHelpGet < $zgSwipeUnless) {
|
||||||
if((int)$order["helpUserLevel"]!==0){
|
$parentData = Db::name('user_trees')->where(array('uid'=>$curZgSwipeTo))->find();
|
||||||
$vm->insertHelpSaleNotice($order["helpUserId"], $orderId, $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),
|
// 无上级,不滑动
|
||||||
'预获助购转换所扣', 0);
|
if (empty($parentData)) break;
|
||||||
$sm->addSysSummary($calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),0,2,'订单【'.($order['orderNo']?:'--').'】被助购转换所扣');
|
// 用户ID是1或者0,不滑动了
|
||||||
$vm->insertVouchersNotice($order['helpUserId'], $orderId, $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), 0,
|
if ($parentData['pid'] != 1 && $parentData['pid'] != 0) break;
|
||||||
'预获产品券转换所扣',0);
|
// 只有进行了滑动,才进行赋值
|
||||||
$vm->insertAlreadyVouchersNotice($order['helpUserId'], $orderId, $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100), 0,
|
$isZgSwipe = true;
|
||||||
'预获产品券转换所得',1);
|
$curZgSwipeTo = $parentData['pid'];
|
||||||
}else{
|
$zgSwipeToLevel ++;
|
||||||
$vm->insertHelpSaleNotice($order["helpUserId"], $orderId, 0,
|
// 继续判断
|
||||||
'预获产品券转换所扣', 0);
|
$helpSaleInfo = Db::name("user_vouchers_summary")->where(['userId'=>$curZgSwipeTo])->find();
|
||||||
}
|
if($helpSaleInfo===null){$userHelpGet=0;}
|
||||||
|
else{$userHelpGet = (float)$helpSaleInfo['helpSaleNum'];}
|
||||||
// 9.26添加
|
}
|
||||||
//四级功能相关字:购户吉日获得“已获优惠券”为 00时 00分 15秒 ? 年2020? 月10? 日01
|
|
||||||
//四级功能相关字:购户吉日获得“已获优惠券”的留言?祝您及家人幸福安康
|
|
||||||
//四级功能相关字:购户吉日获得“已获优惠券”为“助购值”的?% 50
|
|
||||||
$sysConf = (new SCM())->getSysConfigs();
|
|
||||||
if (isset($sysConf['jiri_jiyan']) && isset($sysConf['jiri_get_percent']) && !empty(floatval($sysConf['jiri_get_percent'])) && isset($sysConf['jiri']) ) {
|
|
||||||
if (date('Y/m/d') == date('Y-m-d', strtotime($sysConf['jiri']))) {
|
|
||||||
$zhugou_value = $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100);
|
|
||||||
$jiri_get_percent = floatval($sysConf['jiri_get_percent']);
|
|
||||||
$jiri_jiyan = $sysConf['jiri_jiyan'];
|
|
||||||
$vm->insertAlreadyVouchersNotice($userId, $orderId, 0, round($zhugou_value*$jiri_get_percent*100, 5), $jiri_jiyan);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($zgSwipeUseReal) {
|
||||||
// 10.15添加:助购户的 助购预获 减少的同时 代快付值等额减少
|
$order['helpUserLevel'] = $zgSwipeToLevel;
|
||||||
if ((int)$order["helpUserLevel"] === 1) {
|
|
||||||
Db::name("orders")->where(compact('orderId'))->update([
|
|
||||||
"helpGetCount"=>$order['goodsMoney']*((int)$order["helpUserLevel"]),
|
|
||||||
"helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),
|
|
||||||
]);}
|
|
||||||
else {
|
|
||||||
Db::name("orders")->where(compact('orderId'))->update([
|
|
||||||
"helpGetCount"=>$order['goodsMoney']*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase"),
|
|
||||||
"helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
$order['helpUserId'] = $curZgSwipeTo;
|
||||||
|
|
||||||
|
|
||||||
|
// 20201203购物股 * 层数*基数
|
||||||
|
$buyerPreProductNum = round(($calBaseNum * (dataConf('couponPercentCanUsetGet')*0.01)),5);//1
|
||||||
|
$totalMoney = $order['realTotalMoney'];//产品额
|
||||||
|
$buyerPreProductNum = $buyerPreProductNum > $totalMoney ? $totalMoney : $buyerPreProductNum;
|
||||||
|
// 10.15添加:助购户的 助购预获 减少的同时 代快付值等额减少
|
||||||
|
if ($order["helpUserLevel"] > 1) {
|
||||||
|
$buyerPreProductNum = $buyerPreProductNum*((int)$order["helpUserLevel"])*(float)dataConf("helpSaleCalBase");
|
||||||
|
}
|
||||||
|
Db::name("orders")->where(compact('orderId'))->update([
|
||||||
|
"helpGetCount"=>$buyerPreProductNum,
|
||||||
|
"helpGetCount2"=>$calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// step 5 平台送自己:10000×N“助购预获”,
|
||||||
|
// 10000“购物股”;
|
||||||
|
// 10000×0.4×0.5×0.5=1000“预获优惠券”。
|
||||||
|
$vm->insertHelpSaleNotice($userId, $orderId, $buyerPreProductNum, '订单【'.$order['orderNo'].'】购户购物所得', 1);
|
||||||
|
|
||||||
|
// step 8 平台送自己的上第N层:扣减“助购预获”、“购物股”各10000×0.4×0.5=2000,
|
||||||
|
// 同时添加10000×0.4×0.5=2000“已获产品券”。
|
||||||
|
// 被助购户:购户选的第几层对应的用户
|
||||||
|
if((int)$order["helpUserLevel"]>0){
|
||||||
|
// 购户获得已获优惠券是在助购吧购的物的优惠款的? %
|
||||||
|
$yhyhq_zh = $calBaseNum*((float)dataConf('helpSaleAlreadyCouponGet')/100);
|
||||||
|
if ($yhyhq_zh > $calBaseNum) $yhyhq_zh = $calBaseNum;
|
||||||
|
$yhcpq_zh = $calBaseNum*(1-(float)dataConf('helpSaleCouponsCalBase')/100-(float)dataConf('helpSaleAlreadyCouponGet')/100);
|
||||||
|
if ($yhcpq_zh < 0) $yhcpq_zh = 0;
|
||||||
|
//原来 计算被助购户获得【已获产品券】的算式为u×n%×(1-50%),
|
||||||
|
//现在 计算被助购户获得【已获产品券】的算式为u×n%×(1-50%-20%),
|
||||||
|
// 根据设置新添的【购户获得已获优惠券是在助购吧购的物的优惠款的?20%】,
|
||||||
|
// 同时计算该助购户自己获得【已获优惠券】的算式为u×n%×20%,
|
||||||
|
if ($isZgSwipe) {
|
||||||
|
$sm->addSysSummary($yhcpq_zh,0,2,'订单【'.($order['orderNo']?:'--').'】购物股被助购上滑转换所扣');
|
||||||
|
$vm->insertHelpSaleNotice($order["helpUserId"], $orderId, $yhyhq_zh,
|
||||||
|
'预获助购被助购上滑转换所扣', 0);
|
||||||
|
$vm->insertVouchersNotice($order['helpUserId'], $orderId, $yhcpq_zh, 0,
|
||||||
|
'购物股被助购上滑转换所扣',0);
|
||||||
|
$vm->insertAlreadyVouchersNotice($order['helpUserId'], $orderId, $yhcpq_zh, 0,
|
||||||
|
'订单【'.($order['orderNo']?:'--').'】购物股被助购上滑转换所得',1);
|
||||||
|
} else {
|
||||||
|
$sm->addSysSummary($yhcpq_zh,0,2,'订单【'.($order['orderNo']?:'--').'】被助购转换所扣');
|
||||||
|
$vm->insertHelpSaleNotice($order["helpUserId"], $orderId, $yhyhq_zh,
|
||||||
|
'预获助购被助购转换所扣', 0);
|
||||||
|
$vm->insertVouchersNotice($order['helpUserId'], $orderId, $yhcpq_zh, 0,
|
||||||
|
'购物股被助购转换所扣',0);
|
||||||
|
$vm->insertAlreadyVouchersNotice($order['helpUserId'], $orderId, $yhcpq_zh, 0,
|
||||||
|
'订单【'.($order['orderNo']?:'--').'】被助购转换所得',1);
|
||||||
|
}
|
||||||
|
// 同时计算该助购户自己获得【已获优惠券】的算式为u×n%×20%
|
||||||
|
$sm->addSysSummary($yhyhq_zh,0,2,'订单【'.($order['orderNo']?:'--').'】助购转换所扣');
|
||||||
|
$vm->insertHelpSaleNotice($userId, $orderId, $yhyhq_zh,
|
||||||
|
'预获助购助购转换所扣', 0);
|
||||||
|
$vm->insertVouchersNotice($userId, $orderId, 0, $yhyhq_zh,
|
||||||
|
'助购转换所扣',0);
|
||||||
|
$vm->insertAlreadyVouchersNotice($userId, $orderId, 0, $yhyhq_zh,
|
||||||
|
'订单【'.($order['orderNo']?:'--').'】助购转换所得',1);
|
||||||
|
}else{
|
||||||
|
$vm->insertHelpSaleNotice($order["helpUserId"], $orderId, 0,
|
||||||
|
'购物股被助购转换所扣0', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 9.26添加
|
||||||
|
//四级功能相关字:购户吉日获得“已获优惠券”为 00时 00分 15秒 ? 年2020? 月10? 日01
|
||||||
|
//四级功能相关字:购户吉日获得“已获优惠券”的留言?祝您及家人幸福安康
|
||||||
|
//四级功能相关字:购户吉日获得“已获优惠券”为“助购值”的?% 50
|
||||||
|
try {
|
||||||
|
$sysConf = (new SCM())->getSysConfigs();
|
||||||
|
if (date('Y-m-d', strtotime($order['ctime'])) == date('Y-m-d', strtotime($sysConf['jiri']))) {
|
||||||
|
$sm = Model('common/SysSummary');
|
||||||
|
$toPayInfo = $sm->getInfo(['id'=>1],'toPaySlow');
|
||||||
|
$toPaySlow = (float)$toPayInfo['toPaySlow'];
|
||||||
|
$jiri_get_percent = floatval($sysConf['jiri_get_percent']);
|
||||||
|
$giveValue = round($toPaySlow*((float)$jiri_get_percent/100), 5);
|
||||||
|
// 先扣了
|
||||||
|
// 购户吉日应该获得的“已获优惠券”的值>该购户的“预获优惠券”值的值
|
||||||
|
$vsm = Model('common/Table');
|
||||||
|
$vsm->setTable('user_vouchers_summary');
|
||||||
|
$u_current_expected_num = $vsm->getInfo(['userId'=>$userId]);
|
||||||
|
/** @var float $u_c_e_c_n 当前用户的预获优惠券 */
|
||||||
|
$u_c_e_c_n = (float)$u_current_expected_num['expectedCouponsNum'];
|
||||||
|
// 退回 “购户吉日应该获得的“已获优惠券”的值>该购户的“预获优惠券”值的值”之中,意思是(应该获得的值大于该购户的值的值),也就是超出的部分。
|
||||||
|
if ($giveValue >= $u_c_e_c_n) {
|
||||||
|
if ($u_c_e_c_n <= 0) {
|
||||||
|
$turnBackValue = $giveValue;
|
||||||
|
$realGiveValue = 0;
|
||||||
|
} else {
|
||||||
|
$turnBackValue = $giveValue - $u_c_e_c_n;
|
||||||
|
$realGiveValue = $u_c_e_c_n;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$turnBackValue = 0;
|
||||||
|
$realGiveValue = $giveValue;
|
||||||
|
}
|
||||||
|
if ($giveValue >= 0.0001) {
|
||||||
|
$jiri_jiyan = $sysConf['jiri_jiyan'];
|
||||||
|
$vm->insertAlreadyVouchersNotice($userId, $orderId, 0, $realGiveValue, "【购户吉日】:".$jiri_jiyan);
|
||||||
|
}
|
||||||
|
$sm->addSysSummary(0,$giveValue,2,"订单【".($order['orderNo']?:'--')."】因购户吉日送出助购值");
|
||||||
|
if ($turnBackValue >= 0.0001) {
|
||||||
|
$sm->addSysSummary(0,$turnBackValue,1,"【购户吉日】订单【".($order['orderNo']?:'--')."】助购值被退回");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
errLog($e);
|
||||||
|
}
|
||||||
//新增订单日志
|
//新增订单日志
|
||||||
$logOrder = [];
|
$logOrder = [];
|
||||||
$logOrder['orderId'] = $orderId;
|
$logOrder['orderId'] = $orderId;
|
||||||
@ -2266,7 +2353,7 @@ class Orders extends Base{
|
|||||||
$lm['targetId'] = $userId;
|
$lm['targetId'] = $userId;
|
||||||
$lm['dataId'] = $orderId;
|
$lm['dataId'] = $orderId;
|
||||||
$lm['dataSrc'] = 1;
|
$lm['dataSrc'] = 1;
|
||||||
$lm['remark'] = '交易订单【'.$v['orderNo'].'】支出¥'.$needPay;
|
$lm['remark'] = '订单【'.$v['orderNo'].'】支出';
|
||||||
$lm['moneyType'] = 0;
|
$lm['moneyType'] = 0;
|
||||||
$lm['money'] = $needPay;
|
$lm['money'] = $needPay;
|
||||||
$lm['payType'] = 0;
|
$lm['payType'] = 0;
|
||||||
@ -2639,7 +2726,7 @@ class Orders extends Base{
|
|||||||
$lm['targetId'] = $userId;
|
$lm['targetId'] = $userId;
|
||||||
$lm['dataId'] = $order->orderId;
|
$lm['dataId'] = $order->orderId;
|
||||||
$lm['dataSrc'] = 1;
|
$lm['dataSrc'] = 1;
|
||||||
$lm['remark'] = '交易订单【'.$order->orderNo.'】支出¥'.$tmpNeedPay;
|
$lm['remark'] = '订单【'.$order->orderNo.'】支出';
|
||||||
$lm['moneyType'] = 0;
|
$lm['moneyType'] = 0;
|
||||||
$lm['money'] = $tmpNeedPay;
|
$lm['money'] = $tmpNeedPay;
|
||||||
$lm['payType'] = 'wallets';
|
$lm['payType'] = 'wallets';
|
||||||
@ -2820,19 +2907,19 @@ class Orders extends Base{
|
|||||||
//记录各个券支出
|
//记录各个券支出
|
||||||
//产品券
|
//产品券
|
||||||
if($order->productNum > 0){
|
if($order->productNum > 0){
|
||||||
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'交易订单【'.$order->orderNo.'】支出¥'.$order->productNum,0,$order->productNum,'qlgpay',1);
|
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'订单【'.$order->orderNo.'】支出',0,$order->productNum,'qlgpay',1);
|
||||||
}
|
}
|
||||||
//优惠券
|
//优惠券
|
||||||
if($order->couponsNum > 0){
|
if($order->couponsNum > 0){
|
||||||
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'交易订单【'.$order->orderNo.'】支出¥'.$order->couponsNum,0,$order->couponsNum,'qlgpay',2);
|
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'订单【'.$order->orderNo.'】支出',0,$order->couponsNum,'qlgpay',2);
|
||||||
}
|
}
|
||||||
//旺旺券
|
//旺旺券
|
||||||
if($order->wangNum > 0){
|
if($order->wangNum > 0){
|
||||||
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'交易订单【'.$order->orderNo.'】支出¥'.$order->wangNum,0,$order->wangNum,'qlgpay',3);
|
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'订单【'.$order->orderNo.'】支出',0,$order->wangNum,'qlgpay',3);
|
||||||
}
|
}
|
||||||
//现金
|
//现金
|
||||||
if($order->moneyNum > 0){
|
if($order->moneyNum > 0){
|
||||||
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'交易订单【'.$order->orderNo.'】支出¥'.$order->moneyNum,0,$order->moneyNum,'qlgpay',4);
|
Model('common/LogMoneys')->addMoneyLog(0,$userId,$order->orderId,1,'订单【'.$order->orderNo.'】支出',0,$order->moneyNum,'qlgpay',4);
|
||||||
//$lmm->insert($lm);//加入记录,不扣减
|
//$lmm->insert($lm);//加入记录,不扣减
|
||||||
}
|
}
|
||||||
//创建一条支出流水记录
|
//创建一条支出流水记录
|
||||||
@ -2841,7 +2928,7 @@ class Orders extends Base{
|
|||||||
// $lm['targetId'] = $userId;
|
// $lm['targetId'] = $userId;
|
||||||
// $lm['dataId'] = $order->orderId;
|
// $lm['dataId'] = $order->orderId;
|
||||||
// $lm['dataSrc'] = 1;
|
// $lm['dataSrc'] = 1;
|
||||||
// $lm['remark'] = '交易订单【'.$order->orderNo.'】支出¥'.$tmpNeedPay;
|
// $lm['remark'] = '订单【'.$order->orderNo.'】支出';
|
||||||
// $lm['moneyType'] = 0;
|
// $lm['moneyType'] = 0;
|
||||||
// $lm['money'] = $tmpNeedPay;
|
// $lm['money'] = $tmpNeedPay;
|
||||||
// $lm['payType'] = 'ect';
|
// $lm['payType'] = 'ect';
|
||||||
@ -3025,7 +3112,7 @@ class Orders extends Base{
|
|||||||
$lm['targetId'] = $userId;
|
$lm['targetId'] = $userId;
|
||||||
$lm['dataId'] = $order->orderId;
|
$lm['dataId'] = $order->orderId;
|
||||||
$lm['dataSrc'] = 1;
|
$lm['dataSrc'] = 1;
|
||||||
$lm['remark'] = '交易订单【'.$order->orderNo.'】支出¥'.$tmpNeedPay;
|
$lm['remark'] = '订单【'.$order->orderNo.'】支出';
|
||||||
$lm['moneyType'] = 0;
|
$lm['moneyType'] = 0;
|
||||||
$lm['money'] = $tmpNeedPay;
|
$lm['money'] = $tmpNeedPay;
|
||||||
$lm['payType'] = 'ect';
|
$lm['payType'] = 'ect';
|
||||||
|
@ -18,63 +18,60 @@ class Settlements extends Base
|
|||||||
//获取优惠款 价格*优惠率
|
//获取优惠款 价格*优惠率
|
||||||
$m = Model('common/Table');
|
$m = Model('common/Table');
|
||||||
$m->setTable('order_goods');
|
$m->setTable('order_goods');
|
||||||
$orderGoodsList = $m->getList(['orderId'=>$orderId],'goodsPrice,goodsNum,freight,discountRate');
|
$discountMoney = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner')
|
||||||
$discountMoney = 0;//优惠款
|
->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01');
|
||||||
foreach ($orderGoodsList as &$v) {
|
$discountMoney = round($discountMoney, 5);
|
||||||
//$discountMoney += ($v['goodsPrice']*$v['goodsNum'] + $v['freight']) * ($v['discountRate']*0.01);//优惠款
|
$calBaseNum = $discountMoney;
|
||||||
$discountMoney += ($v['goodsPrice']*$v['goodsNum']) * ($v['discountRate']*0.01);//优惠款
|
|
||||||
}
|
|
||||||
$discountMoney = round($discountMoney,5);
|
|
||||||
//加入快代付值
|
//加入快代付值
|
||||||
Model('SysSummary')->addToPayFast($orderId,$discountMoney,'订单【'.($order['orderNo']?:'--').'】优惠款加入');
|
Model('SysSummary')->addToPayFast($orderId,$discountMoney,'订单【'.($order['orderNo']?:'--').'】优惠款加入');
|
||||||
//获取产品额
|
//获取产品额
|
||||||
$totalMoney = $order->realTotalMoney;//产品额
|
$totalMoney = $order->realTotalMoney;//产品额
|
||||||
if(2 != $order->goodsType){//助微吧商品不给购户券值
|
if(2 != $order->goodsType){//助微吧商品不给购户券值
|
||||||
// 购户的所得分配
|
// 购户的所得分配
|
||||||
// 1,购户获得预获产品券为产品额的100% buyerPreProductInProductScale
|
// 1,购户获得购物股为产品额的100% buyerPreProductInProductScale
|
||||||
// 2,购户获得预获优惠券为优惠款的50% buyerPreCoupousInSaleScale
|
// 2,购户获得预获优惠券为优惠款的50% buyerPreCoupousInSaleScale
|
||||||
// 3,获得预获产品券为被扣手续费的100% buyerPreProductInHandlingFeeScale
|
// 3,获得购物股为被扣手续费的100% buyerPreProductInHandlingFeeScale
|
||||||
// 4,获得预获产品券为被扣税费的100% buyerPreProductInTaxFeeScale
|
// 4,获得购物股为被扣税费的100% buyerPreProductInTaxFeeScale
|
||||||
// 5,获得预获产品券为被扣手续费的100% buyerPreProductInProductHandlingFeeScale
|
// 5,获得购物股为被扣手续费的100% buyerPreProductInProductHandlingFeeScale
|
||||||
// 6,获得预获产品券为被扣税费的100% buyerPreProductInProductTaxFeeScale
|
// 6,获得购物股为被扣税费的100% buyerPreProductInProductTaxFeeScale
|
||||||
|
|
||||||
// 购户获得预获产品券最高占产品额比例?%
|
// 购户获得购物股最高占产品额比例?%
|
||||||
// $buyerPreProductNum = round(($totalMoney + $order->deliverMoney),5);//1
|
// $buyerPreProductNum = round(($totalMoney + $order->deliverMoney),5);//1
|
||||||
$buyerPreProductNum = round(($discountMoney * (dataConf('couponPercentCanUsetGet')*0.01)),5);//1
|
$buyerPreProductNum = round(($discountMoney * (dataConf('couponPercentCanUsetGet')*0.01)),5);//1
|
||||||
$buyerMaxCouponsNum = round(($totalMoney + $order->deliverMoney)* (dataConf('buyerPreProductInProductScale')*0.01),5);//1
|
$buyerMaxCouponsNum = round(($totalMoney)* (dataConf('buyerPreProductInProductScale')*0.01),5);//1
|
||||||
$buyerPreCoupousNum = round($discountMoney * (dataConf('buyerPreCoupousInSaleScale')*0.01),5);//2
|
$buyerPreCoupousNum = round($discountMoney * (dataConf('buyerPreCoupousInSaleScale')*0.01),5);//2
|
||||||
// $buyerPreProductNum += round($order->productHandlingFee * (dataConf('buyerPreProductInHandlingFeeScale')*0.01),2);//3
|
// $buyerPreProductNum += round($order->productHandlingFee * (dataConf('buyerPreProductInHandlingFeeScale')*0.01),2);//3
|
||||||
// $buyerPreProductNum += round($order->productTaxFee * (dataConf('buyerPreProductInTaxFeeScale')*0.01),2);//4
|
// $buyerPreProductNum += round($order->productTaxFee * (dataConf('buyerPreProductInTaxFeeScale')*0.01),2);//4
|
||||||
// $buyerPreProductNum += round($order->couponsHandlingFee * (dataConf('buyerPreProductInProductHandlingFeeScale')*0.01),2);//5
|
// $buyerPreProductNum += round($order->couponsHandlingFee * (dataConf('buyerPreProductInProductHandlingFeeScale')*0.01),2);//5
|
||||||
// $buyerPreProductNum += round($order->couponsTaxFee * (dataConf('buyerPreProductInProductTaxFeeScale')*0.01),2);//6
|
// $buyerPreProductNum += round($order->couponsTaxFee * (dataConf('buyerPreProductInProductTaxFeeScale')*0.01),2);//6
|
||||||
|
if(3 == $order->goodsType){
|
||||||
|
// helpSaleCouponsCalBase == 基数
|
||||||
|
$buyerPreProductNum *= (float)dataConf('helpSaleCouponsCalBase')/100;
|
||||||
|
$buyerPreCoupousNum *= (float)dataConf('helpSaleCouponsCalBase')/100;
|
||||||
|
}
|
||||||
$buyerPreCoupousNum = $buyerPreCoupousNum > $buyerMaxCouponsNum ? $buyerMaxCouponsNum : $buyerPreCoupousNum;
|
$buyerPreCoupousNum = $buyerPreCoupousNum > $buyerMaxCouponsNum ? $buyerMaxCouponsNum : $buyerPreCoupousNum;
|
||||||
|
$buyerPreProductNum = $buyerPreProductNum > $totalMoney ? $totalMoney : $buyerPreProductNum;
|
||||||
if($buyerPreProductNum > 0 || $buyerPreCoupousNum > 0){
|
if($buyerPreProductNum > 0 || $buyerPreCoupousNum > 0){
|
||||||
if(3 == $order->goodsType){
|
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$buyerPreCoupousNum,'订单【'.$order->orderNo.'】购户购物所得');
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$buyerPreCoupousNum*((float)dataConf('helpSaleCouponsCalBase')/100),'交易订单【'.$order->orderNo.'】购户购物所得');
|
|
||||||
}else{
|
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($order->userId,$orderId,$buyerPreProductNum,$buyerPreCoupousNum,'交易订单【'.$order->orderNo.'】购户购物所得');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 商户的所得分配
|
// 商户的所得分配
|
||||||
// 1,商户获得预获产品券占优惠款比例 100% sellerPreProductInProductScale
|
// 1,商户获得购物股占优惠款比例 100% sellerPreProductInProductScale
|
||||||
// 2,商户获得预获优惠券占优惠款比例 100% sellerPreCoupousInSaleScale
|
// 2,商户获得预获优惠券占优惠款比例 100% sellerPreCoupousInSaleScale
|
||||||
// 3,优惠款-产品-优惠券-旺旺券,大于0是商户需付公司的钱,小于0是公司需付给商户的钱,即旺旺券
|
// 3,优惠款-产品-优惠券-旺旺券,大于0是商户需付公司的钱,小于0是公司需付给商户的钱,即旺旺券
|
||||||
// $discountMoney-$order->productNum-$order->couponsNum-$order->wangNum-$order->moneyNum
|
// $discountMoney-$order->productNum-$order->couponsNum-$order->wangNum-$order->moneyNum
|
||||||
$sellerPreProductNum = round($discountMoney * (dataConf('sellerPreProductInProductScale')*0.01),5);//1
|
$sellerPreProductNum = round($discountMoney * (dataConf('sellerPreProductInProductScale')*0.01),5);//1
|
||||||
$sellerPreCoupousNum = round($discountMoney * (dataConf('sellerPreCoupousInSaleScale')*0.01),5);//2
|
$sellerPreCoupousNum = round($discountMoney * (dataConf('sellerPreCoupousInSaleScale')*0.01),5);//2
|
||||||
$calBaseNum = Db::table("__ORDERS__ o")->join("__ORDER_GOODS__ g", "g.orderId=o.orderId", 'inner')
|
|
||||||
->where(['o.orderId'=>$orderId])->sum('g.goodsPrice*g.goodsNum*g.discountRate*0.01');
|
|
||||||
if($sellerPreProductNum >= 0.01 || $sellerPreCoupousNum>=0.01){
|
if($sellerPreProductNum >= 0.01 || $sellerPreCoupousNum>=0.01){
|
||||||
if(3 != $order->goodsType){
|
if(3 != $order->goodsType){
|
||||||
// step 3 平台送商户:10000×0.4=4000“预获产品券”
|
// step 3 平台送商户:10000×0.4=4000“购物股”
|
||||||
// 10000×0.4=4000“预获优惠券”
|
// 10000×0.4=4000“预获优惠券”
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($shops['userId'], $orderId, $calBaseNum, $calBaseNum,
|
Model('common/UserVouchers')->insertVouchersNotice($shops['userId'], $orderId, $calBaseNum, $calBaseNum,
|
||||||
'交易订单【'.$order->orderNo.'】商户售物所得',1);
|
'订单【'.$order->orderNo.'】商户售物所得',1);
|
||||||
}else{
|
}else{
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($shops['userId'],$orderId,$sellerPreProductNum,$sellerPreCoupousNum,'交易订单【'.$order->orderNo.'】商户售物所得');
|
Model('common/UserVouchers')->insertVouchersNotice($shops['userId'],$orderId,$sellerPreProductNum,$sellerPreCoupousNum,'订单【'.$order->orderNo.'】商户售物所得');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,38 +80,58 @@ class Settlements extends Base
|
|||||||
}else{
|
}else{
|
||||||
$toCalBaseNum = $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100);
|
$toCalBaseNum = $calBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100);
|
||||||
}
|
}
|
||||||
// step 4 平台送商户的推荐人:当消费超过限制值时10000×0.4×0.5×0.5=1000“预获产品券”。
|
// step 4 平台送商户的推荐人:当消费超过限制值时10000×0.4×0.5×0.5=1000“购物股”。
|
||||||
// 当消费低于限制值时10000×0.4×0.5×0.2=400“预获产品券”。
|
// 当消费低于限制值时10000×0.4×0.5×0.2=400“购物股”。
|
||||||
$uUserId = UserTrees::getUpperId($shops["userId"]);
|
$uUserId = UserTrees::getUpperId($shops["userId"]);
|
||||||
if($uUserId == null || $uUserId == 0){$uUserId = 1;}
|
if($uUserId == null || $uUserId == 0){$uUserId = 1;}
|
||||||
$data = Db::query('SELECT sum(`goodsMoney`) as `total` FROM `hyh_orders` WHERE DATE_FORMAT(`createTime`,"%Y%m%d")=DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day),"%Y%m%d") and `userId`="'.$uUserId.'"');
|
$data = Db::query('SELECT sum(`goodsMoney`) as `total` FROM `hyh_orders` WHERE DATE_FORMAT(`createTime`,"%Y%m%d")=DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day),"%Y%m%d") and `userId`="'.$uUserId.'"');
|
||||||
// 因为count一定会有数据所以不判断了
|
// 因为count一定会有数据所以不判断了
|
||||||
if((float)$data[0]["total"]<=(float)dataConf("refPreProductYdGTMoney")){
|
if((float)$data[0]["total"]<=(float)dataConf("refPreProductYdGTMoney")){
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$toCalBaseNum*((float)dataConf("refPreProductNoInSaleScale")/100),
|
$someCalBaseNum = $toCalBaseNum*((float)dataConf("refPreProductNoInSaleScale")/100);
|
||||||
0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1);
|
|
||||||
}else{
|
}else{
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$toCalBaseNum*((float)dataConf('helpSaleCouponsCalBase')/100)*((float)dataConf("refPreProductYesInSaleScale")/100),
|
$someCalBaseNum = $toCalBaseNum*((float)dataConf("refPreProductYesInSaleScale")/100);
|
||||||
0,'交易订单【'.$order['orderNo'].'】推荐商户所得',1);
|
|
||||||
}
|
}
|
||||||
// step 6 平台送自己的推荐人:当消费超过限制值时10000×0.4×0.5×0.5=1000“预获产品券”;
|
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$someCalBaseNum,
|
||||||
// 当消费低于限制值时10000×0.4×0.5×0.2=400“预获产品券”。
|
0,'订单【'.$order['orderNo'].'】推荐商户所得',1);
|
||||||
|
$childes = DB::table("hyh_user_trees")->where(["pid"=>$uUserId])->field("uid")->select();
|
||||||
|
foreach ($childes as $child){
|
||||||
|
$someCalBaseNum *= ((float)dataConf("balanceTjrGet")/100);
|
||||||
|
Model('common/UserVouchers')->insertVouchersNotice($child['uid'], $orderId,
|
||||||
|
$someCalBaseNum/sizeof($childes), 0,
|
||||||
|
'订单【'.$order['orderNo'].'】被商户推荐人推荐所得',1);
|
||||||
|
}
|
||||||
|
// step 6 平台送自己的推荐人:当消费超过限制值时10000×0.4×0.5×0.5=1000“购物股”;
|
||||||
|
// 当消费低于限制值时10000×0.4×0.5×0.2=400“购物股”。
|
||||||
|
// 推荐人的推荐所得是指:推荐人推荐的购户购物后的推荐所得,和推荐人推荐的商户售物后的推荐所得
|
||||||
|
// 购户均衡获得购物股是推荐人的推荐所得的? %
|
||||||
$uUserId = UserTrees::getUpperId($order['userId']);
|
$uUserId = UserTrees::getUpperId($order['userId']);
|
||||||
if($uUserId == null || $uUserId == 0){$uUserId = 1;}
|
if($uUserId == null || $uUserId == 0){$uUserId = 1;}
|
||||||
$data = Db::query('SELECT sum(`goodsMoney`) as `total` FROM `hyh_orders` WHERE DATE_FORMAT(`createTime`,"%Y%m%d")=DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day),"%Y%m%d") and `userId`="'.$uUserId.'"');
|
$data = Db::query('SELECT sum(`goodsMoney`) as `total` FROM `hyh_orders` WHERE DATE_FORMAT(`createTime`,"%Y%m%d")=DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 day),"%Y%m%d") and `userId`="'.$uUserId.'"');
|
||||||
// 因为count一定会有数据所以不判断了
|
// 因为count一定会有数据所以不判断了
|
||||||
if($data[0]["total"]<=dataConf("refPreProductYdGTMoney")){
|
if($data[0]["total"]<=dataConf("refPreProductYdGTMoney")){
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$toCalBaseNum*((float)dataConf("refPreProductNoInSaleScale")/100),
|
$someCalBaseNum = $toCalBaseNum*((float)dataConf("refPreProductNoInSaleScale")/100);
|
||||||
0,'交易订单【'.$order['orderNo'].'】推荐购户所得',1);
|
|
||||||
}else{
|
}else{
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$toCalBaseNum*((float)dataConf("refPreProductYesInSaleScale")/100),
|
$someCalBaseNum = $toCalBaseNum*((float)dataConf("refPreProductYesInSaleScale")/100);
|
||||||
0,'交易订单【'.$order['orderNo'].'】推荐购户所得',1);
|
|
||||||
}
|
}
|
||||||
// step 7 平台送自己的被推荐人:10000×0.4×0.5×0.5÷5=200“预获产品券”。
|
Model('common/UserVouchers')->insertVouchersNotice($uUserId, $orderId,$someCalBaseNum,
|
||||||
|
0,'订单【'.$order['orderNo'].'】推荐购户所得',1);
|
||||||
|
// step 7 平台送自己的被推荐人:10000×0.4×0.5×0.5÷5=200“购物股”。
|
||||||
$childes = DB::table("hyh_user_trees")->where(["pid"=>$order['userId']])->field("uid")->select();
|
$childes = DB::table("hyh_user_trees")->where(["pid"=>$order['userId']])->field("uid")->select();
|
||||||
foreach ($childes as $child){
|
foreach ($childes as $child){
|
||||||
|
// 推荐人的推荐所得是指:推荐人推荐的购户购物后的推荐所得,和推荐人推荐的商户售物后的推荐所得
|
||||||
|
// 购户均衡获得购物股是推荐人的推荐所得的? %
|
||||||
|
// balanceTjrGet
|
||||||
|
$toCalBaseNum *= ((float)dataConf('balanceTjrGet')/100);
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($child['uid'], $orderId,
|
Model('common/UserVouchers')->insertVouchersNotice($child['uid'], $orderId,
|
||||||
$toCalBaseNum*((float)dataConf("helpSaleChildrenGet")/100)/sizeof($childes), 0,
|
$toCalBaseNum*((float)dataConf("helpSaleChildrenGet")/100)/sizeof($childes), 0,
|
||||||
'交易订单【'.$order['orderNo'].'】被推荐所得',1);
|
'订单【'.$order['orderNo'].'】被购户推荐所得',1);
|
||||||
|
}
|
||||||
|
$childes = DB::table("hyh_user_trees")->where(["pid"=>$uUserId])->field("uid")->select();
|
||||||
|
foreach ($childes as $child){
|
||||||
|
$someCalBaseNum *= ((float)dataConf('balanceTjrGet')/100);
|
||||||
|
Model('common/UserVouchers')->insertVouchersNotice($child['uid'], $orderId,
|
||||||
|
$someCalBaseNum/sizeof($childes), 0,
|
||||||
|
'订单【'.$order['orderNo'].'】被购户推荐人推荐所得',1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -125,7 +142,7 @@ class Settlements extends Base
|
|||||||
$m->setTable('orders');
|
$m->setTable('orders');
|
||||||
if($giveWangNum > 0){
|
if($giveWangNum > 0){
|
||||||
$m->updateInfo(['orderId'=>$orderId],['certificateStatus'=>1,'payable'=>$giveWangNum]);
|
$m->updateInfo(['orderId'=>$orderId],['certificateStatus'=>1,'payable'=>$giveWangNum]);
|
||||||
Model('common/LogMoneys')->addMoneyLog(1,$order->shopId,$order->orderId,1,'交易订单【'.$order->orderNo.'】结算收入¥'.$giveWangNum,1,$giveWangNum,'qlgpay',3);
|
Model('common/LogMoneys')->addMoneyLog(1,$order->shopId,$order->orderId,1,'订单【'.$order->orderNo.'】商户售物所得',1,$giveWangNum,'qlgpay',3);
|
||||||
}else{
|
}else{
|
||||||
$m->updateInfo(['orderId'=>$orderId],['certificateStatus'=>0,'payable'=>$giveWangNum]);
|
$m->updateInfo(['orderId'=>$orderId],['certificateStatus'=>0,'payable'=>$giveWangNum]);
|
||||||
}
|
}
|
||||||
@ -144,12 +161,12 @@ class Settlements extends Base
|
|||||||
$yesterdayBuyMoney = Model('common/Orders')->getYesterdayBuyMoney($agentUserId,'realTotalMoney');
|
$yesterdayBuyMoney = Model('common/Orders')->getYesterdayBuyMoney($agentUserId,'realTotalMoney');
|
||||||
$agentProductMoney = 0;
|
$agentProductMoney = 0;
|
||||||
if($yesterdayBuyMoney >= dataConf('shopPreCoupousYdGTMoney')){//大于设定值
|
if($yesterdayBuyMoney >= dataConf('shopPreCoupousYdGTMoney')){//大于设定值
|
||||||
$agentProductMoney = round($totalMoney * (dataConf('shopPreCoupousYesInProductScale')*0.01),5);//1
|
$agentProductMoney = round($calBaseNum * (dataConf('shopPreCoupousYesInProductScale')*0.01),5);//1
|
||||||
}else{
|
}else{
|
||||||
$agentProductMoney = round($totalMoney * (dataConf('shopPreCoupousNoInProductScale')*0.01),5);//2
|
$agentProductMoney = round($calBaseNum * (dataConf('shopPreCoupousNoInProductScale')*0.01),5);//2
|
||||||
}
|
}
|
||||||
if($agentProductMoney >= 0.01){
|
if($agentProductMoney >= 0.0001){
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($agentUserId,$orderId,0,$agentProductMoney,'交易订单【'.$order->orderNo.'】商超所得');
|
Model('common/UserVouchers')->insertVouchersNotice($agentUserId,$orderId,0,$agentProductMoney,'订单【'.$order->orderNo.'】商超监管购户所得');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//乡镇代理
|
//乡镇代理
|
||||||
@ -161,12 +178,12 @@ class Settlements extends Base
|
|||||||
$yesterdayBuyMoney = Model('common/Orders')->getYesterdayBuyMoney($agentUserId,'realTotalMoney');
|
$yesterdayBuyMoney = Model('common/Orders')->getYesterdayBuyMoney($agentUserId,'realTotalMoney');
|
||||||
$agentProductMoney = 0;
|
$agentProductMoney = 0;
|
||||||
if($yesterdayBuyMoney >= dataConf('shopPreCoupousYdGTMoney')){//大于设定值
|
if($yesterdayBuyMoney >= dataConf('shopPreCoupousYdGTMoney')){//大于设定值
|
||||||
$agentProductMoney = round($totalMoney * (dataConf('shopPreCoupousYesInProductScale')*0.01),5);//1
|
$agentProductMoney = round($calBaseNum * (dataConf('shopPreCoupousYesInProductScale')*0.01),5);//1
|
||||||
}else{
|
}else{
|
||||||
$agentProductMoney = round($totalMoney * (dataConf('shopPreCoupousNoInProductScale')*0.01),5);//2
|
$agentProductMoney = round($calBaseNum * (dataConf('shopPreCoupousNoInProductScale')*0.01),5);//2
|
||||||
}
|
}
|
||||||
if($agentProductMoney >= 0.01){
|
if($agentProductMoney >= 0.01){
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($agentUserId,$orderId,0,$agentProductMoney,'交易订单【'.$order->orderNo.'】商厦所得');
|
Model('common/UserVouchers')->insertVouchersNotice($agentUserId,$orderId,0,$agentProductMoney,'订单【'.$order->orderNo.'】商厦监管购户所得');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//区县代理
|
//区县代理
|
||||||
@ -177,20 +194,20 @@ class Settlements extends Base
|
|||||||
$yesterdayBuyMoney = Model('common/Orders')->getYesterdayBuyMoney($agentUserId,'realTotalMoney');
|
$yesterdayBuyMoney = Model('common/Orders')->getYesterdayBuyMoney($agentUserId,'realTotalMoney');
|
||||||
$agentProductMoney = 0;
|
$agentProductMoney = 0;
|
||||||
if($yesterdayBuyMoney >= dataConf('shopPreCoupousYdGTMoney')){//大于设定值
|
if($yesterdayBuyMoney >= dataConf('shopPreCoupousYdGTMoney')){//大于设定值
|
||||||
$agentProductMoney = round($totalMoney * (dataConf('shopPreCoupousYesInProductScale')*0.01),5);//1
|
$agentProductMoney = round($calBaseNum * (dataConf('shopPreCoupousYesInProductScale')*0.01),5);//1
|
||||||
}else{
|
}else{
|
||||||
$agentProductMoney = round($totalMoney * (dataConf('shopPreCoupousNoInProductScale')*0.01),5);//2
|
$agentProductMoney = round($calBaseNum * (dataConf('shopPreCoupousNoInProductScale')*0.01),5);//2
|
||||||
}
|
}
|
||||||
if($agentProductMoney >= 0.01){
|
if($agentProductMoney >= 0.01){
|
||||||
Model('common/UserVouchers')->insertVouchersNotice($agentUserId,$orderId,0,$agentProductMoney,'交易订单【'.$order->orderNo.'】商都所得');
|
Model('common/UserVouchers')->insertVouchersNotice($agentUserId,$orderId,0,$agentProductMoney,'订单【'.$order->orderNo.'】商都监管购户所得');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//推荐人所得
|
//推荐人所得
|
||||||
// 1,推荐人获得预获产品券时限上日有消费≥10元为优惠款的50%。
|
// 1,推荐人获得购物股时限上日有消费≥10元为优惠款的50%。
|
||||||
// refPreProductYdGTMoney refPreProductYesInSaleScale
|
// refPreProductYdGTMoney refPreProductYesInSaleScale
|
||||||
// 2,推荐人获得预获产品券时限上日有消费<10元为优惠款的25% refPreProductNoInSaleScale
|
// 2,推荐人获得购物股时限上日有消费<10元为优惠款的25% refPreProductNoInSaleScale
|
||||||
// 20200114 -- 说用不上,注释
|
// 20200114 -- 说用不上,注释
|
||||||
// $m->setTable('user_trees');
|
// $m->setTable('user_trees');
|
||||||
// $pid = $m->getField(['uid'=>$shops['userId']],'pid');
|
// $pid = $m->getField(['uid'=>$shops['userId']],'pid');
|
||||||
|
@ -19,8 +19,6 @@ class SysSummary extends Base{
|
|||||||
$noticeData['desc'] = $sm;
|
$noticeData['desc'] = $sm;
|
||||||
$noticeData['createTime'] = time();
|
$noticeData['createTime'] = time();
|
||||||
Db::name('sys_notice')->insert($noticeData);
|
Db::name('sys_notice')->insert($noticeData);
|
||||||
// 原:当购户“预获优惠券”、“预获产品券”的值同时≤15元时,所获“已获优惠券”、“已获产品券”转入代快付值
|
|
||||||
// 改为:当购户“预获优惠券”、“预获产品券”的值同时≤15元时,所获“已获优惠券”、“已获产品券”转入代慢付值
|
|
||||||
$this->addSysSummary($payFastNum, $paySlowNum, 1,$sm);
|
$this->addSysSummary($payFastNum, $paySlowNum, 1,$sm);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -54,8 +54,9 @@ class UserTrees extends Base
|
|||||||
|
|
||||||
public static function realGetUsersHelpSaleNum($fromUsers, $level){
|
public static function realGetUsersHelpSaleNum($fromUsers, $level){
|
||||||
$count = DB::table("hyh_orders")->where("userId='$fromUsers' and helpUserLevel='$level' and orderStatus=2")->sum("helpGetCount");
|
$count = DB::table("hyh_orders")->where("userId='$fromUsers' and helpUserLevel='$level' and orderStatus=2")->sum("helpGetCount");
|
||||||
$count -= DB::table("hyh_orders")->where("helpUserId='$fromUsers' and helpUserLevel='$level' and orderStatus=2")->sum("helpGetCount2");
|
$minus = DB::table("hyh_orders")->where("helpUserId='$fromUsers' and helpUserLevel='$level' and orderStatus=2")->sum("helpGetCount");
|
||||||
return round($count, 2);
|
// $count -= DB::table("hyh_orders")->where("helpUserId='$fromUsers' and helpUserLevel='$level' and orderStatus=2")->sum("helpGetCount2");
|
||||||
|
return round($count-$minus, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function realGetLevelsDownBetween($fromUser, $toUser, $level=0){
|
public static function realGetLevelsDownBetween($fromUser, $toUser, $level=0){
|
||||||
|
@ -6,23 +6,14 @@ use think\Db;
|
|||||||
* 券数据
|
* 券数据
|
||||||
*/
|
*/
|
||||||
class UserVouchers extends Base{
|
class UserVouchers extends Base{
|
||||||
public function startGiveVouchers(){
|
public function startRevokeVouchers(){
|
||||||
if('127.0.0.1' != $ip = request()->ip(0) ) return $ip;
|
$LOG = "=========================================".PHP_EOL;
|
||||||
set_time_limit(0);
|
// if('127.0.0.1' != $ip = request()->ip(0) ) return $ip;
|
||||||
$sm = Model('common/SysSummary');
|
set_time_limit(0);
|
||||||
$sysData= $sm->getInfo('toPayFast,toPaySlow');
|
$m = Model('common/Table');
|
||||||
//获取代快付值
|
$m->setTable('user_vouchers_summary');
|
||||||
$toPayFast = $sysData['toPayFast'];
|
Db::startTrans();
|
||||||
//今日代快付释放值
|
try{
|
||||||
$payFast = round($toPayFast * (dataConf('fastPayDayScale')*0.01),5);
|
|
||||||
//获取代慢付值
|
|
||||||
$toPaySlow = $sysData['toPaySlow'];
|
|
||||||
//今日付慢付释放值
|
|
||||||
$paySlow = round($toPaySlow * (dataConf('slowPayDayScale')*0.01),5);
|
|
||||||
//应释放总额
|
|
||||||
$toPaySum = $payFast + $paySlow;
|
|
||||||
Db::startTrans();
|
|
||||||
try{
|
|
||||||
$m = Model('common/Table');
|
$m = Model('common/Table');
|
||||||
$m->setTable('user_vouchers_summary');
|
$m->setTable('user_vouchers_summary');
|
||||||
if(1 == date('j')){
|
if(1 == date('j')){
|
||||||
@ -32,35 +23,119 @@ class UserVouchers extends Base{
|
|||||||
foreach ($giveList as &$g) {
|
foreach ($giveList as &$g) {
|
||||||
if($g['expectedProductNum'] > 0){
|
if($g['expectedProductNum'] > 0){
|
||||||
$decNum = $g['expectedProductNum'] * $monthScale;
|
$decNum = $g['expectedProductNum'] * $monthScale;
|
||||||
$this->insertVouchersNotice($g['userId'],0,$decNum,0,$desc='预获产品券月耗损',0,1);
|
$this->insertVouchersNotice($g['userId'],0,$decNum,0,$desc='月损耗所扣',0,1);
|
||||||
}
|
}
|
||||||
if($g['expectedCouponsNum'] > 0){
|
if($g['expectedCouponsNum'] > 0){
|
||||||
$decNum = $g['expectedCouponsNum'] * $monthScale;
|
$decNum = $g['expectedCouponsNum'] * $monthScale;
|
||||||
$this->insertVouchersNotice($g['userId'],0,0,$decNum,$desc='预获优惠券月耗损',0,1);
|
$this->insertVouchersNotice($g['userId'],0,0,$decNum,$desc='预获优惠券月损耗所扣',0,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 每次所得值(费、税前)同时扣减“助购预获”值和“购物股”值,直至减为负数为止,负数部分按每天0.1%耗损。
|
||||||
|
// A、当“助购预获”值为负数时,每天0.1%耗损在“购物股”值扣减。
|
||||||
|
// B、当“购物股”值为负数时,每天0.1%耗损在“预获优惠券”值扣减。
|
||||||
|
// C、当“助购预获”值和“购物股”值同为负数时,每天0.1%耗损在“预获优惠券”值同时扣减。
|
||||||
|
$data = Db::name('user_vouchers_summary')->whereOr(["helpSaleNum"=>["lt", 0]])->whereOr(["expectedProductNum"=>["lt", 0]])->select();
|
||||||
|
$LOG .= "=============开始循环=============".PHP_EOL;
|
||||||
|
foreach ($data as $_each){
|
||||||
|
if ($_each['userId'] == 0) continue;
|
||||||
|
$LOG .= "===========当前用户#【{$_each['userId']}】==========".PHP_EOL;
|
||||||
|
$LOG .= "当前用户预获优惠券:{$_each['expectedCouponsNum']};购物股:{$_each['expectedProductNum']};助购券值:{$_each["helpSaleNum"]}".PHP_EOL;
|
||||||
|
if($_each["expectedProductNum"]<0){
|
||||||
|
$LOG .= "17.1、成立".PHP_EOL;
|
||||||
|
$count = abs((float)$_each["expectedProductNum"]);
|
||||||
|
$LOG .= "17.1、负数值:{$count}".PHP_EOL;
|
||||||
|
if($_each["helpSaleNum"] < 0) {
|
||||||
|
$LOG .= "17.2、成立".PHP_EOL;
|
||||||
|
$count += abs((float)$_each["helpSaleNum"]);
|
||||||
|
$LOG .= "17.2、负数值:{$count}".PHP_EOL;
|
||||||
|
}
|
||||||
|
$val = $count*((float)dataConf("deductionRateWhennegPreCoupons")/100);
|
||||||
|
$LOG .= "17.3、:扣除预获优惠券:{$val}【助购券负值日损耗所扣】".PHP_EOL;
|
||||||
|
model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, 0, $val,
|
||||||
|
"助购券负值日损耗所扣", 0);
|
||||||
|
}else{
|
||||||
|
$LOG .= "17.4、成立".PHP_EOL;
|
||||||
|
$count = abs((float)$_each["helpSaleNum"]);
|
||||||
|
$LOG .= "17.4、负数值:{$count}".PHP_EOL;
|
||||||
|
$val = $count*((float)dataConf("deductionRateWhennegPreCoupons")/100);
|
||||||
|
$LOG .= "17.5、:扣除预获优惠券:{$val}【助购券负值日损耗所扣】".PHP_EOL;
|
||||||
|
model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, $val,
|
||||||
|
0, "助购券负值日损耗所扣", 0);
|
||||||
|
}
|
||||||
|
$LOG .= "=========当前用户#【{$_each['userId']}】结束========".PHP_EOL;
|
||||||
|
}
|
||||||
|
$LOG .= "=============循环结束=============".PHP_EOL;
|
||||||
|
Db::commit();
|
||||||
|
\think\Log::write($LOG);
|
||||||
|
return WSTReturn("ok", 1);
|
||||||
|
}catch (\Exception $e) {
|
||||||
|
dump($e);
|
||||||
|
Db::rollback();errLog($e);
|
||||||
|
return WSTReturn($e->getMessage(),-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function startGiveVouchers(){
|
||||||
|
$LOG = "=========================================".PHP_EOL;
|
||||||
|
// if('127.0.0.1' != $ip = request()->ip(0) ) return $ip;
|
||||||
|
set_time_limit(0);
|
||||||
|
$sm = Model('common/SysSummary');
|
||||||
|
$sysData= $sm->getInfo('toPayFast,toPaySlow');
|
||||||
|
//获取代快付值
|
||||||
|
$toPayFast = $sysData['toPayFast'];
|
||||||
|
$HistoryToPayFast = $sysData['toPayFast'];
|
||||||
|
//今日代快付释放值
|
||||||
|
$payFast = round($toPayFast * (dataConf('fastPayDayScale')*0.01),5);
|
||||||
|
//获取代慢付值
|
||||||
|
$toPaySlow = $sysData['toPaySlow'];
|
||||||
|
$HistoryToPaySlow = $sysData['toPaySlow'];
|
||||||
|
$m = Model('common/Table');
|
||||||
|
$m->setTable('user_vouchers_summary');
|
||||||
|
$HistoryVouchersSummarySum = $m->getSum(['isDisabled'=>0],'expectedProductNum+expectedCouponsNum');
|
||||||
|
//今日付慢付释放值
|
||||||
|
$paySlow = round($toPaySlow * (dataConf('slowPayDayScale')*0.01),5);
|
||||||
|
//应释放总额
|
||||||
|
$toPaySum = $payFast + $paySlow;
|
||||||
|
$LOG .= <<<TXT
|
||||||
|
---当前代快付值:{$HistoryToPayFast}
|
||||||
|
1、代快付释放值:{$payFast}
|
||||||
|
---当前代慢付值:{$HistoryToPaySlow}
|
||||||
|
2、代慢付释放值:{$paySlow}
|
||||||
|
5、释放总额:{$toPaySum}
|
||||||
|
|
||||||
|
TXT;
|
||||||
|
Db::startTrans();
|
||||||
|
try{
|
||||||
|
$m = Model('common/Table');
|
||||||
|
$m->setTable('user_vouchers_summary');
|
||||||
$where['isDisabled'] = 0;
|
$where['isDisabled'] = 0;
|
||||||
//总预获产品券
|
//总购物股
|
||||||
$allPreProduct = $m->getSum($where,'expectedProductNum');
|
$allPreProduct = $m->getSum($where,'expectedProductNum');
|
||||||
//总预获优惠券
|
//总预获优惠券
|
||||||
$allPreCoupons = $m->getSum($where,'expectedCouponsNum');
|
$allPreCoupons = $m->getSum($where,'expectedCouponsNum');
|
||||||
//最大释放总额 预代付值 * 比例
|
//最大释放总额 预代付值 * 比例
|
||||||
$maxPayNum = round(($allPreProduct + $allPreCoupons) * (dataConf('couponsMaxGiveSacle')*0.01),2);
|
$maxPayNum = ($allPreProduct + $allPreCoupons) * (dataConf('couponsMaxGiveSacle')*0.01);
|
||||||
|
$LOG .= "3、最大释放总额:{$maxPayNum}".PHP_EOL;
|
||||||
|
$LOG .= "4、转换前预代付值:".($allPreProduct + $allPreCoupons).PHP_EOL;
|
||||||
if($toPaySum > $maxPayNum){
|
if($toPaySum > $maxPayNum){
|
||||||
//加入代慢付值
|
//加入代慢付值
|
||||||
|
$LOG .= "6、成立".PHP_EOL;
|
||||||
$addPaySlow = round($toPaySum - $maxPayNum,5);
|
$addPaySlow = round($toPaySum - $maxPayNum,5);
|
||||||
|
$LOG .= "6、代慢付增加:{$addPaySlow}【应释放总额大于最大释放总额】".PHP_EOL;
|
||||||
$sm->addSysSummary(0,$addPaySlow,1,'应释放总额大于最大释放总额');
|
$sm->addSysSummary(0,$addPaySlow,1,'应释放总额大于最大释放总额');
|
||||||
}
|
}
|
||||||
//扣减系统释放值
|
//扣减系统释放值
|
||||||
if ($paySlow < 0) $paySlow = 0;
|
if ($paySlow < 0) $paySlow = 0;
|
||||||
if ($payFast < 0) $payFast = 0;
|
if ($payFast < 0) $payFast = 0;
|
||||||
|
$minusSysNum = $payFast+$paySlow;
|
||||||
|
$LOG .= "---系统扣除:快:{$payFast};慢:{$paySlow}【扣减系统释放值】".PHP_EOL;
|
||||||
$sm->addSysSummary($payFast,$paySlow,2,'扣减系统释放值');
|
$sm->addSysSummary($payFast,$paySlow,2,'扣减系统释放值');
|
||||||
//取最小值作为总释放额
|
//取最小值作为总释放额
|
||||||
$payNum = min($maxPayNum,$toPaySum);
|
$payNum = min($maxPayNum,$toPaySum);
|
||||||
if($payNum==0) return;
|
if($payNum==0) return;
|
||||||
//每人应释放数
|
//每人应释放数
|
||||||
$personNum = $payNum / ($allPreProduct + $allPreCoupons);
|
$personNum = $payNum / ($allPreProduct + $allPreCoupons);
|
||||||
|
$LOG .= "8、计算基数1:{$personNum}".PHP_EOL;
|
||||||
//将所有未释放的的isGive设为0
|
//将所有未释放的的isGive设为0
|
||||||
//获取今日0点时间戳
|
//获取今日0点时间戳
|
||||||
$today = strtotime(date("Y-m-d"),time());
|
$today = strtotime(date("Y-m-d"),time());
|
||||||
@ -75,85 +150,145 @@ class UserVouchers extends Base{
|
|||||||
giveDay
|
giveDay
|
||||||
');
|
');
|
||||||
$time = time();
|
$time = time();
|
||||||
|
$LOG .= "=============开始循环=============".PHP_EOL;
|
||||||
foreach ($list as &$v) {
|
foreach ($list as &$v) {
|
||||||
|
if ($v['userId'] == 0) continue;
|
||||||
|
$LOG .= "===========当前用户#【{$v['userId']}】==========".PHP_EOL;
|
||||||
|
$LOG .= "当前用户预获优惠券:{$v['expectedCouponsNum']};购物股:{$v['expectedProductNum']}".PHP_EOL;
|
||||||
unset($data);
|
unset($data);
|
||||||
$minNumer = 15;
|
$minNumer = 15;
|
||||||
//都小于15不统计,直接加入代慢付
|
//都小于15不统计,直接加入代慢付
|
||||||
|
// 原:当购户“预获优惠券”、“购物股”的值同时≤15元时,所获“已获优惠券”、“已获产品券”转入代快付值
|
||||||
|
// 改为:当购户“预获优惠券”、“购物股”的值同时≤15元时,所获“已获优惠券”、“已获产品券”转入代慢付值
|
||||||
|
$couponsScale = dataConf('hasCoupousScale');//优惠券比例
|
||||||
|
$productScale = 100 - $couponsScale;//产品券比例
|
||||||
if($v['expectedProductNum'] <= $minNumer && $v['expectedCouponsNum'] <= $minNumer){
|
if($v['expectedProductNum'] <= $minNumer && $v['expectedCouponsNum'] <= $minNumer){
|
||||||
$toSlowNum = round($personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']),2);
|
$LOG .= "9、预获优惠券:{$v['expectedCouponsNum']};购物股:{$v['expectedProductNum']},均小于15".PHP_EOL;
|
||||||
$sm->addSysSummary(0,$toSlowNum,1,'用户ID['.$v['userId'].']双预获券都小于15,直接加入代慢付');
|
$toSlowNum = round($personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']),5);
|
||||||
|
$LOG .= "9、退回系统慢值:{$toSlowNum}".PHP_EOL;
|
||||||
|
$sm->addSysSummary(0,$toSlowNum,1,'用户ID['.$v['userId'].']双预获券都小于15/日转换退回');
|
||||||
|
$LOG .= "=========当前用户#【{$v['userId']}】结束========".PHP_EOL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}else if($v['expectedProductNum'] <= $minNumer){//购物股小于15;
|
||||||
if($v['expectedProductNum'] < $minNumer){//预获产品券小于15;
|
$LOG .= "10、购物股:{$v['expectedProductNum']}小于15".PHP_EOL;
|
||||||
$personAlreadyProductNum = 0;
|
$personAlreadyProductNum = 0;
|
||||||
$personAlreadyCouponsNum = round($personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']),2);
|
$personAlreadyCouponsNum = $personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']);
|
||||||
}else if($v['expectedCouponsNum'] < $minNumer){//预获优惠券小于15
|
$LOG .= "10、用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
|
$LOG .= "10、用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
|
}else if($v['expectedCouponsNum'] <= $minNumer){//预获优惠券小于15
|
||||||
|
$LOG .= "11、预获优惠券:{$v['expectedCouponsNum']}小于15".PHP_EOL;
|
||||||
$personAlreadyCouponsNum = 0;
|
$personAlreadyCouponsNum = 0;
|
||||||
$personAlreadyProductNum = round($personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']),2);
|
$personAlreadyProductNum = $personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']);
|
||||||
|
$LOG .= "11、用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
|
$LOG .= "11、用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
}else{//都大于15
|
}else{//都大于15
|
||||||
$couponsScale = dataConf('hasCoupousScale');//优惠券比例
|
$LOG .= "---优惠券比例:{$couponsScale}".PHP_EOL;
|
||||||
$productScale = 100 - $couponsScale;//产品券比例
|
$LOG .= "---产品券比例:{$productScale}".PHP_EOL;
|
||||||
$personAlreadyProductNum = $personNum * round(($v['expectedProductNum'] + $v['expectedCouponsNum']) * ($productScale*0.01),2);
|
$personAlreadyProductNum = $personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']) * ($productScale*0.01);
|
||||||
$personAlreadyCouponsNum = $personNum * round(($v['expectedProductNum'] + $v['expectedCouponsNum']) * ($couponsScale*0.01),2);
|
$personAlreadyCouponsNum = $personNum * ($v['expectedProductNum'] + $v['expectedCouponsNum']) * ($couponsScale*0.01);
|
||||||
}
|
$LOG .= "8.1、用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
//实际有预获产品券小于应给值
|
$LOG .= "8.2、用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
|
}
|
||||||
|
//都小于就算了
|
||||||
|
if($v['expectedProductNum'] < $personAlreadyProductNum && $v['expectedCouponsNum'] < $personAlreadyCouponsNum){
|
||||||
|
$LOG .= "12、用户需要获得的已获产品券:{$personAlreadyProductNum} < 购物股:{$v['expectedProductNum']}".PHP_EOL;
|
||||||
|
$LOG .= "12、用户需要获得的已获优惠券:{$personAlreadyCouponsNum} < 预获优惠券:{$v['expectedCouponsNum']}".PHP_EOL;
|
||||||
|
$personAlreadyProductNum = 0;
|
||||||
|
$personAlreadyCouponsNum = 0;
|
||||||
|
$LOG .= "---用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
|
$LOG .= "---用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
|
}
|
||||||
|
//实际有购物股小于应给值
|
||||||
if($v['expectedProductNum'] < $personAlreadyProductNum){
|
if($v['expectedProductNum'] < $personAlreadyProductNum){
|
||||||
|
$LOG .= "13、用户需要获得的已获产品券:{$personAlreadyProductNum} < 购物股:{$v['expectedProductNum']}".PHP_EOL;
|
||||||
$personAlreadyCouponsNum += $personAlreadyProductNum;
|
$personAlreadyCouponsNum += $personAlreadyProductNum;
|
||||||
$personAlreadyProductNum = 0;
|
$personAlreadyProductNum = 0;
|
||||||
|
$LOG .= "---用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
|
$LOG .= "---用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
}
|
}
|
||||||
//实际有预获优惠券小于应给值
|
//实际有预获优惠券小于应给值
|
||||||
if($v['expectedCouponsNum'] < $personAlreadyCouponsNum){
|
if($v['expectedCouponsNum'] < $personAlreadyCouponsNum){
|
||||||
|
$LOG .= "14、用户需要获得的已获优惠券:{$personAlreadyCouponsNum} < 预获优惠券:{$v['expectedCouponsNum']}".PHP_EOL;
|
||||||
$personAlreadyProductNum += $personAlreadyCouponsNum;
|
$personAlreadyProductNum += $personAlreadyCouponsNum;
|
||||||
$personAlreadyCouponsNum = 0;
|
$personAlreadyCouponsNum = 0;
|
||||||
|
$LOG .= "---用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
|
$LOG .= "---用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
}
|
}
|
||||||
//都小于就算了
|
|
||||||
if($v['expectedProductNum'] < $personAlreadyProductNum || $v['expectedCouponsNum'] < $personAlreadyCouponsNum){
|
$LOG .= "最终:用户需要获得的已获产品券:{$personAlreadyProductNum}".PHP_EOL;
|
||||||
$personAlreadyProductNum = 0;
|
$LOG .= "最终:用户需要获得的已获优惠券:{$personAlreadyCouponsNum}".PHP_EOL;
|
||||||
$personAlreadyCouponsNum = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if($personAlreadyProductNum >= 0.01){
|
if($personAlreadyProductNum >= 0.01){
|
||||||
|
|
||||||
$this->insertVouchersNotice($v['userId'],0,$personAlreadyProductNum,0,$desc='分润扣减',0,0);//预获产品券减
|
$LOG .= "用户扣购物股:{$personAlreadyProductNum}【购物股日转换所扣】".PHP_EOL;
|
||||||
|
$this->insertVouchersNotice($v['userId'],0,$personAlreadyProductNum,0,$desc='购物股日转换所扣',0,0);//购物股减
|
||||||
//加入变动记录,最后一位//1产品券2优惠券3旺旺券4现金券
|
//加入变动记录,最后一位//1产品券2优惠券3旺旺券4现金券
|
||||||
$this->insertAlreadyVouchersNotice($v['userId'],0,$personAlreadyProductNum,0,'预获产品券转换所得',1,1);
|
$LOG .= "用户加已获产品券:{$personAlreadyProductNum}【日转换所得】".PHP_EOL;
|
||||||
// Model('common/LogMoneys')->addMoneyLog(0,$v['userId'],0,2,'预获产品券转换所得',1,$personAlreadyProductNum,'dayPay',1);
|
$this->insertAlreadyVouchersNotice($v['userId'],0,$personAlreadyProductNum,0,'日转换所得',1,1);
|
||||||
|
// Model('common/LogMoneys')->addMoneyLog(0,$v['userId'],0,2,'购物股日转换所得',1,$personAlreadyProductNum,'dayPay',1);
|
||||||
$data['alreadyProductNum'] = $v['alreadyProductNum'] + $personAlreadyProductNum;//已获产品券加
|
$data['alreadyProductNum'] = $v['alreadyProductNum'] + $personAlreadyProductNum;//已获产品券加
|
||||||
}
|
}
|
||||||
if($personAlreadyCouponsNum >= 0.01){
|
if($personAlreadyCouponsNum >= 0.01){
|
||||||
$this->insertVouchersNotice($v['userId'],0,0,$personAlreadyCouponsNum,$desc='分润扣减',0,0);//预获优惠券减
|
$LOG .= "用户扣预获优惠券:{$personAlreadyCouponsNum}【预获优惠券日转换所扣】".PHP_EOL;
|
||||||
|
$this->insertVouchersNotice($v['userId'],0,0,$personAlreadyCouponsNum,$desc='预获优惠券日转换所扣',0,0);//预获优惠券减
|
||||||
//加入变动记录,最后一位//1产品券2优惠券3旺旺券4现金券
|
//加入变动记录,最后一位//1产品券2优惠券3旺旺券4现金券
|
||||||
$this->insertAlreadyVouchersNotice($v['userId'],0,0,$personAlreadyCouponsNum,'预获优惠券转换所得',1,1);
|
$LOG .= "用户加已获优惠券:{$personAlreadyCouponsNum}【预获优惠券日转换所得】".PHP_EOL;
|
||||||
// Model('common/LogMoneys')->addMoneyLog(0,$v['userId'],0,2,'预获优惠券转换所得',1,$personAlreadyCouponsNum,'dayPay',2);
|
$this->insertAlreadyVouchersNotice($v['userId'],0,0,$personAlreadyCouponsNum,'预获优惠券日转换所得',1,1);
|
||||||
|
// Model('common/LogMoneys')->addMoneyLog(0,$v['userId'],0,2,'预获优惠券日转换所得',1,$personAlreadyCouponsNum,'dayPay',2);
|
||||||
$data['alreadyCouponsNum'] = $v['alreadyCouponsNum'] + $personAlreadyCouponsNum;//已获优惠券加
|
$data['alreadyCouponsNum'] = $v['alreadyCouponsNum'] + $personAlreadyCouponsNum;//已获优惠券加
|
||||||
}
|
}
|
||||||
$data['isGive'] = 1;
|
$data['isGive'] = 1;
|
||||||
$data['giveDate'] = $time;
|
$data['giveDate'] = $time;
|
||||||
$data['giveDay'] = $v['giveDay'] + 1;
|
$data['giveDay'] = $v['giveDay'] + 1;
|
||||||
Db::name('user_vouchers_summary')->where(['id'=>$v['id']])->update($data);
|
Db::name('user_vouchers_summary')->where(['id'=>$v['id']])->update($data);
|
||||||
|
$LOG .= "=========当前用户#【{$v['userId']}】结束========".PHP_EOL;
|
||||||
}
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
Db::startTrans();
|
$LOG .= "=============循环结束=============".PHP_EOL;
|
||||||
// 每次所得值(费、税前)同时扣减“助购预获”值和“预获产品券”值,直至减为负数为止,负数部分按每天0.1%耗损。
|
|
||||||
// A、当“助购预获”值为负数时,每天0.1%耗损在“预获产品券”值扣减。
|
$sm = Model('common/SysSummary');
|
||||||
// B、当“预获产品券”值为负数时,每天0.1%耗损在“预获优惠券”值扣减。
|
$sysData= $sm->getInfo('toPayFast,toPaySlow');
|
||||||
// C、当“助购预获”值和“预获产品券”值同为负数时,每天0.1%耗损在“预获优惠券”值同时扣减。
|
$toPayFast = $sysData['toPayFast'];
|
||||||
$data = Db::name('user_vouchers_summary')->whereOr(["helpSaleNum"=>["lt", 0]])->whereOr(["expectedProductNum"=>["lt", 0]])->select();
|
$toPaySlow = $sysData['toPaySlow'];
|
||||||
foreach ($data as $_each){
|
$m = Model('common/Table');
|
||||||
if($_each["expectedProductNum"]<0){
|
$m->setTable('user_vouchers_summary');
|
||||||
$count = (float)$_each["expectedProductNum"];
|
$vouchersSummarySum = $m->getSum(['isDisabled'=>0],'expectedProductNum+expectedCouponsNum');
|
||||||
if($_each["helpSaleNum"] < 0)$count+=(float)$_each["helpSaleNum"];
|
$deltaFast = $HistoryToPayFast - $toPayFast;
|
||||||
model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100),
|
$deltaSlow = $HistoryToPaySlow - $toPaySlow;
|
||||||
"预获产品券为负,每天耗损预获优惠券", 0);
|
$deltaConv = $HistoryVouchersSummarySum - $vouchersSummarySum;
|
||||||
}else{
|
$unConv = $deltaFast + $deltaSlow - $deltaConv;
|
||||||
$count = (float)$_each["helpSaleNum"];
|
$LOG .= <<<TXT
|
||||||
model('common/UserVouchers')->insertVouchersNotice($_each["userId"], 0, $count*((float)dataConf("deductionRateWhennegPreCoupons")/100),
|
---当前代快付值:{$toPayFast}
|
||||||
0, "助购券为负,每天耗损预获产品券", 0);
|
---当前代慢付值:{$toPaySlow}
|
||||||
}
|
18、转换后预代付值:{$vouchersSummarySum}
|
||||||
}
|
19、预代付值差值:{$deltaConv}
|
||||||
Db::commit();
|
---代快付值差值:{$deltaFast}
|
||||||
return WSTReturn("ok", 1);
|
---代慢付值差值:{$deltaSlow}
|
||||||
|
---未转换值:{$unConv}
|
||||||
|
|
||||||
|
TXT;
|
||||||
|
|
||||||
|
if ($unConv > 0) $sm->addSysSummary(0, $unConv, 1, "加入系统未转换值");
|
||||||
|
|
||||||
|
\think\Log::write($LOG);
|
||||||
|
\think\Log::write(<<<TEXT
|
||||||
|
系统未转换值调试内容:
|
||||||
|
hpf={$HistoryToPayFast}
|
||||||
|
hps={$HistoryToPaySlow}
|
||||||
|
hvs={$HistoryVouchersSummarySum}
|
||||||
|
tpf={$toPayFast}
|
||||||
|
tps={$toPaySlow}
|
||||||
|
pf={$payFast}
|
||||||
|
ps={$paySlow}
|
||||||
|
vs={$vouchersSummarySum}
|
||||||
|
ms={$minusSysNum}
|
||||||
|
df={$deltaFast}
|
||||||
|
ds={$deltaSlow}
|
||||||
|
dc={$deltaConv}
|
||||||
|
uc={$unConv}
|
||||||
|
TEXT
|
||||||
|
);
|
||||||
|
return WSTReturn("ok", 1);
|
||||||
}catch (\Exception $e) {
|
}catch (\Exception $e) {
|
||||||
dump($e);
|
dump($e);
|
||||||
Db::rollback();errLog($e);
|
Db::rollback();errLog($e);
|
||||||
@ -164,7 +299,7 @@ class UserVouchers extends Base{
|
|||||||
* 插入已获会员券值记录
|
* 插入已获会员券值记录
|
||||||
* @param [type] $userId [会员ID]
|
* @param [type] $userId [会员ID]
|
||||||
* @param [type] $orderId [订单ID]
|
* @param [type] $orderId [订单ID]
|
||||||
* @param integer $expectedProductNum [预获产品券]
|
* @param integer $expectedProductNum [购物股]
|
||||||
* @param integer $expectedCouponsNum [预获优惠券]
|
* @param integer $expectedCouponsNum [预获优惠券]
|
||||||
* @param string $desc [备注]
|
* @param string $desc [备注]
|
||||||
* @param string $isAdd [1增加0扣除]
|
* @param string $isAdd [1增加0扣除]
|
||||||
@ -197,7 +332,7 @@ class UserVouchers extends Base{
|
|||||||
* 插入已获会员券值记录
|
* 插入已获会员券值记录
|
||||||
* @param [type] $userId [会员ID]
|
* @param [type] $userId [会员ID]
|
||||||
* @param [type] $orderId [订单ID]
|
* @param [type] $orderId [订单ID]
|
||||||
* @param integer $expectedProductNum [预获产品券]
|
* @param integer $expectedProductNum [购物股]
|
||||||
* @param integer $expectedCouponsNum [预获优惠券]
|
* @param integer $expectedCouponsNum [预获优惠券]
|
||||||
* @param string $desc [备注]
|
* @param string $desc [备注]
|
||||||
* @param string $isAdd [1增加0扣除]
|
* @param string $isAdd [1增加0扣除]
|
||||||
@ -233,7 +368,7 @@ class UserVouchers extends Base{
|
|||||||
* 插入会员券值记录
|
* 插入会员券值记录
|
||||||
* @param [type] $userId [会员ID]
|
* @param [type] $userId [会员ID]
|
||||||
* @param [type] $orderId [订单ID]
|
* @param [type] $orderId [订单ID]
|
||||||
* @param integer $expectedProductNum [预获产品券]
|
* @param integer $expectedProductNum [购物股]
|
||||||
* @param integer $expectedCouponsNum [预获优惠券]
|
* @param integer $expectedCouponsNum [预获优惠券]
|
||||||
* @param string $desc [备注]
|
* @param string $desc [备注]
|
||||||
* @param string $isAdd [1增加0扣除]
|
* @param string $isAdd [1增加0扣除]
|
||||||
|
@ -104,14 +104,14 @@ class Users extends Base{
|
|||||||
->join('user_trees t','u.userId=t.uid')
|
->join('user_trees t','u.userId=t.uid')
|
||||||
->join('user_lock l','u.userId=l.userId')
|
->join('user_lock l','u.userId=l.userId')
|
||||||
->where(['t.pid'=>$userId,'u.userStatus'=>0,'u.userLevel'=>$userLevel])
|
->where(['t.pid'=>$userId,'u.userStatus'=>0,'u.userLevel'=>$userLevel])
|
||||||
->field('u.userId,u.loginName as trueName,u.userPhone,u.userLevel,l.lockReason,l.lockTime,from_unixtime(l.createTime) createTime')
|
->field('u.userId as id, u.loginName as userId,u.loginName as trueName,u.userPhone,u.userLevel,l.lockReason,l.lockTime,from_unixtime(l.createTime) createTime')
|
||||||
->order('l.id DESC,u.userId DESC')
|
->order('l.id DESC,u.userId DESC')
|
||||||
->paginate(input('pageSize/d'))->toArray();
|
->paginate(input('pageSize/d'))->toArray();
|
||||||
}else{
|
}else{
|
||||||
$rs = Db::name('users u')
|
$rs = Db::name('users u')
|
||||||
->join('user_trees t','u.userId=t.uid')
|
->join('user_trees t','u.userId=t.uid')
|
||||||
->where(['t.pid'=>$userId,'u.userStatus'=>1,'u.userLevel'=>$userLevel])
|
->where(['t.pid'=>$userId,'u.userStatus'=>1,'u.userLevel'=>$userLevel])
|
||||||
->field('u.userId,u.trueName,u.userPhone,u.userLevel,u.createTime')
|
->field('u.userId as id, u.loginName as userId,u.trueName,u.userPhone,u.userLevel,u.createTime')
|
||||||
->order('u.userId DESC')
|
->order('u.userId DESC')
|
||||||
->paginate(input('pageSize/d'))->toArray();
|
->paginate(input('pageSize/d'))->toArray();
|
||||||
}
|
}
|
||||||
@ -294,6 +294,8 @@ class Users extends Base{
|
|||||||
// return WSTReturn('注册频繁');
|
// return WSTReturn('注册频繁');
|
||||||
$data = array();
|
$data = array();
|
||||||
$data['loginName'] = input("post.loginName");
|
$data['loginName'] = input("post.loginName");
|
||||||
|
// $data['householdName'] = input("post.householdName");
|
||||||
|
// $data['householdIdCard'] = input("post.householdIdCard");
|
||||||
$data['loginPwd'] = input("post.loginPwd");
|
$data['loginPwd'] = input("post.loginPwd");
|
||||||
$data['reUserPwd'] = $data['loginPwd'] ;//input("post.reUserPwd");
|
$data['reUserPwd'] = $data['loginPwd'] ;//input("post.reUserPwd");
|
||||||
$data['payPwd'] = input("post.payPwd");
|
$data['payPwd'] = input("post.payPwd");
|
||||||
@ -438,6 +440,22 @@ class Users extends Base{
|
|||||||
WSTSendMsg($userId,str_replace($find,$replace,$tpl['tplContent']),['from'=>0,'dataId'=>0]);
|
WSTSendMsg($userId,str_replace($find,$replace,$tpl['tplContent']),['from'=>0,'dataId'=>0]);
|
||||||
}
|
}
|
||||||
create_tree($userId,$pInfo['userId']);
|
create_tree($userId,$pInfo['userId']);
|
||||||
|
//
|
||||||
|
//一、当【助购值】的值大于设置的【全亮共欢迎您助购所得】值时,按设置值给予。
|
||||||
|
//二、当【助购值】的值小于设置的【全亮共欢迎您助购所得】值时,按【助购值】全值给予即可。
|
||||||
|
$sm = Model('common/SysSummary');
|
||||||
|
$vm = new UserVouchers();
|
||||||
|
$get = (float)dataConf('registerMaxGetProductCoupon');
|
||||||
|
$ssm = Model('common/Table');
|
||||||
|
$ssm->setTable('sys_summary');
|
||||||
|
$toPayInfo = $ssm->getInfo(['id'=>1],'toPaySlow');
|
||||||
|
$toPaySlow = (float)$toPayInfo['toPaySlow'];
|
||||||
|
if ($get > $toPaySlow)$get = $toPaySlow;
|
||||||
|
if ($get > 0) {
|
||||||
|
$sm->addSysSummary(0,$get,2,'用户【'.$userId.'】注册赠送所扣');
|
||||||
|
$vm->insertAlreadyVouchersNotice($userId, 0, $get, 0,
|
||||||
|
'全亮共欢迎您助购所得', 1);
|
||||||
|
}
|
||||||
Db::commit();
|
Db::commit();
|
||||||
flock($fp,LOCK_UN);
|
flock($fp,LOCK_UN);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
@ -8,48 +8,7 @@ class Index extends Base{
|
|||||||
protected $beforeActionList = [
|
protected $beforeActionList = [
|
||||||
'checkAuth' => ['only'=>'getsysmessages']
|
'checkAuth' => ['only'=>'getsysmessages']
|
||||||
];
|
];
|
||||||
public function index(){
|
public function index(){
|
||||||
$pay['needPay'] =200;
|
|
||||||
$userId=1;//$this->getUserId()
|
|
||||||
//产品券
|
|
||||||
$buyerMaxProductScale = round(dataConf('buyerMaxProductScale')*0.01,2);
|
|
||||||
$pay['maxProduct'] = $pay['needPay'] * $buyerMaxProductScale;//最大可用产品券
|
|
||||||
$pay['productHandlingFee'] = round(dataConf('useHasHandlingFee')*0.01,2);//产品券手续费
|
|
||||||
$pay['productTaxFee'] = round(dataConf('useHasTaxFee')*0.01,2);//产品券税费
|
|
||||||
$pay['maxAllProduct'] = $this->getMaxNum($pay['maxProduct'],(1-$pay['productHandlingFee']-$pay['productTaxFee'] ));//加上手续费,税费最多扣除产品券
|
|
||||||
|
|
||||||
//优惠券
|
|
||||||
$pay['maxCoupons'] = $pay['needPay'] - $pay['maxProduct'] ;//最大可用其他券,优惠券+旺旺券+现金券
|
|
||||||
$pay['coupousHandlingFee'] = round(dataConf('useHasHandlingFee')*0.01,2);//优惠券手续费
|
|
||||||
$pay['coupousTaxFee'] = round(dataConf('useHasTaxFee')*0.01,2);//优惠券税费
|
|
||||||
$pay['maxAllCoupons'] = $this->getMaxNum($pay['maxCoupons'],(1-$pay['coupousHandlingFee']-$pay['coupousTaxFee'] ));//加上手续费,税费最多扣除优惠券
|
|
||||||
|
|
||||||
$pay['money']['useMoney'] = 0;
|
|
||||||
$pay['wang']['useWang'] = 0;
|
|
||||||
//实际应用最大的产品券
|
|
||||||
$userInfo = getUserInfo(['userId'=>$userId],'couponsNum,productNum,wangNum');
|
|
||||||
$pay['product']['useProduct'] = $userInfo['productNum'] >= $pay['maxAllProduct'] ? $pay['maxAllProduct'] : $userInfo['productNum'];
|
|
||||||
$pay['product']['useProductHandlingFee'] = $pay['product']['useProduct'] * $pay['productHandlingFee'];//产品券手续费
|
|
||||||
$pay['product']['useProductTaxFee'] = $pay['product']['useProduct'] * $pay['productTaxFee'];
|
|
||||||
$pay['product']['useProductOk'] = $pay['product']['useProduct'] - $pay['product']['useProductHandlingFee'] - $pay['product']['useProductTaxFee'];
|
|
||||||
|
|
||||||
//实际应用最大的优惠券
|
|
||||||
$pay['coupons']['useCoupons'] = $userInfo['couponsNum'] >= $pay['maxAllCoupons'] ? $pay['maxAllCoupons'] : $userInfo['couponsNum'];
|
|
||||||
$pay['coupons']['useCouponsHandlingFee'] = round($pay['coupons']['useCoupons'] * $pay['coupousHandlingFee'],2);//产品券手续费
|
|
||||||
$pay['coupons']['useCouponsTaxFee'] = round($pay['coupons']['useCoupons'] * $pay['coupousTaxFee'],2);
|
|
||||||
$pay['coupons']['useCouponsOk'] = $pay['coupons']['useCoupons'] - $pay['coupons']['useCouponsHandlingFee'] - $pay['coupons']['useCouponsTaxFee'];
|
|
||||||
$remNum = $pay['needPay'] - $pay['product']['useProduct'] - $pay['coupons']['useCouponsHandlingFee'];
|
|
||||||
if($remNum > 0 ){
|
|
||||||
//旺旺券
|
|
||||||
$pay['wang']['useWang'] = $userInfo['wangNum'] >= $remNum ? $remNum : $userInfo['wangNum'];
|
|
||||||
$remNum = $pay['needPay'] - $pay['product']['useProduct'] - $pay['coupons']['useCouponsHandlingFee']-$pay['wang']['useWang'];
|
|
||||||
if($remNum > 0 ){
|
|
||||||
$pay['money']['useMoney'] = $remNum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// dump($pay);
|
|
||||||
|
|
||||||
return $this->fetch('index');
|
return $this->fetch('index');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -291,5 +291,5 @@ $secret_token = 'Ix9LwSpAk0QpsH2vAMup0QLEKMVK5UstDxWCIb-_';
|
|||||||
$bucket = 'qlgmall';
|
$bucket = 'qlgmall';
|
||||||
$ql = new SDK($access_token, $secret_token, $bucket);
|
$ql = new SDK($access_token, $secret_token, $bucket);
|
||||||
$response['token'] = $ql->uploadToken($bucket);
|
$response['token'] = $ql->uploadToken($bucket);
|
||||||
$response['url'] = 'http://qlg.ect99.com/';//'http://ppzpdlj0h.bkt.clouddn.com';
|
$response['url'] = 'http://qlgmall.zgqlg.com.cn/';//'http://ppzpdlj0h.bkt.clouddn.com';
|
||||||
echo json_encode($response);
|
echo json_encode($response);
|
Loading…
x
Reference in New Issue
Block a user