添加网站文件
This commit is contained in:
162
application/common/model/AccountLog.php
Normal file
162
application/common/model/AccountLog.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class AccountLog extends Model{
|
||||
/*******************************
|
||||
** 余额变动:100~199
|
||||
** 积分变动:200~299
|
||||
** 成长值变动:300~399
|
||||
** 佣金变动: 400~499
|
||||
*******************************/
|
||||
const admin_add_money = 100;
|
||||
const admin_reduce_money = 101;
|
||||
const recharge_money = 102;
|
||||
const balance_pay_order = 103;
|
||||
const cancel_order_refund = 104;
|
||||
const after_sale_refund = 105;
|
||||
const withdraw_to_balance = 106;
|
||||
const user_transfer_inc_balance = 107;
|
||||
const user_transfer_dec_balance = 108;
|
||||
|
||||
const admin_add_integral = 200;
|
||||
const admin_reduce_integral = 201;
|
||||
const sign_in_integral = 202;
|
||||
const recharge_give_integral = 203;
|
||||
const order_add_integral = 204;
|
||||
const register_add_integral = 205;
|
||||
const invite_add_integral = 206;
|
||||
const order_deduction_integral = 207;
|
||||
const cancel_order_refund_integral = 208;
|
||||
const luck_draw_integral = 209;
|
||||
const deduct_order_first_integral = 210;
|
||||
const order_goods_give_integral = 211;
|
||||
|
||||
const admin_add_growth = 300;
|
||||
const admin_reduce_growth = 301;
|
||||
const sign_give_growth = 302;
|
||||
const recharge_give_growth = 303;
|
||||
const order_give_growth = 304;//下单赠送成长值
|
||||
|
||||
const withdraw_dec_earnings = 400;//提现扣减佣金
|
||||
const withdraw_back_earnings = 401;//提现被拒绝返回佣金
|
||||
const distribution_inc_earnings = 402;//分销订单结算增加佣金
|
||||
|
||||
const money_change = [ //余额变动类型
|
||||
self::admin_add_money,self::admin_reduce_money,self::recharge_money,self::balance_pay_order,self::cancel_order_refund,self::after_sale_refund
|
||||
, self::withdraw_to_balance,self::user_transfer_inc_balance, self::user_transfer_dec_balance
|
||||
];
|
||||
const integral_change = [ //积分变动类型
|
||||
self::admin_add_integral,self::admin_reduce_integral,self::sign_in_integral,self::recharge_give_integral,self::order_add_integral,self::invite_add_integral
|
||||
, self::order_deduction_integral,self::register_add_integral,self::cancel_order_refund_integral,self::luck_draw_integral,self::deduct_order_first_integral
|
||||
, self::order_goods_give_integral
|
||||
];
|
||||
const growth_change = [ //成长值变动类型
|
||||
self::admin_add_growth,self::admin_reduce_growth,self::recharge_give_growth,self::sign_give_growth, self::order_give_growth
|
||||
];
|
||||
|
||||
const earnings_change = [ //佣金变动
|
||||
self::withdraw_dec_earnings, self::withdraw_back_earnings, self::distribution_inc_earnings
|
||||
];
|
||||
|
||||
public static function getAcccountDesc($from = true){
|
||||
$desc = [
|
||||
self::admin_add_money => '系统增加余额',
|
||||
self::admin_reduce_money => '系统扣减余额',
|
||||
self::recharge_money => '用户充值余额',
|
||||
self::admin_add_integral => '系统增加积分',
|
||||
self::admin_reduce_integral => '系统扣减积分',
|
||||
self::sign_in_integral => '每日签到赠送积分',
|
||||
self::recharge_give_integral => '充值赠送积分',
|
||||
self::order_add_integral => '下单赠送积分',
|
||||
self::order_deduction_integral => '下单积分抵扣',
|
||||
self::register_add_integral => '注册赠送积分',
|
||||
self::invite_add_integral => '邀请会员赠送积分',
|
||||
self::admin_add_growth => '系统增加成长值',
|
||||
self::admin_reduce_growth => '系统扣减成长值',
|
||||
self::sign_give_growth => '每日签到赠送成长值',
|
||||
self::recharge_give_growth => '充值赠送成长值',
|
||||
self::balance_pay_order => '下单扣减余额',
|
||||
self::cancel_order_refund => '取消订单退回余额',
|
||||
self::after_sale_refund => '售后退回余额',
|
||||
self::withdraw_to_balance => '佣金提现',
|
||||
self::withdraw_dec_earnings => '提现扣减佣金',
|
||||
self::withdraw_back_earnings => '拒绝提现返还佣金',
|
||||
self::distribution_inc_earnings => '订单结算获得佣金',
|
||||
self::cancel_order_refund_integral => '取消订单退回积分',
|
||||
self::deduct_order_first_integral => '扣除首单积分',
|
||||
self::luck_draw_integral => '积分抽奖中奖',
|
||||
self::order_goods_give_integral => '购买商品赠送积分',
|
||||
self::user_transfer_inc_balance => '会员转账(收入方)',
|
||||
self::user_transfer_dec_balance => '会员转账(支出方)',
|
||||
self::order_give_growth => '下单赠送成长值',
|
||||
];
|
||||
if($from === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
//返回变动类型
|
||||
public static function getChangeType($from){
|
||||
$type = '';
|
||||
if(in_array($from,self::money_change)){
|
||||
$type = 'money';
|
||||
}
|
||||
if(in_array($from,self::integral_change)){
|
||||
$type = 'integral';
|
||||
}
|
||||
if(in_array($from,self::growth_change)){
|
||||
$type = 'growth';
|
||||
}
|
||||
if(in_array($from,self::earnings_change)){
|
||||
$type = 'earnings';
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
public static function getRemarkDesc($from,$source_sn,$remark =''){
|
||||
return $remark;
|
||||
}
|
||||
|
||||
|
||||
public static function getChangeAmountAttr($value,$data){
|
||||
$amount = $value;
|
||||
if(!in_array($data['source_type'],self::money_change)){
|
||||
$amount = intval($value);
|
||||
}
|
||||
if($data['change_type'] == 1){
|
||||
return '+'.$amount;
|
||||
}
|
||||
return '-'.$amount;
|
||||
}
|
||||
|
||||
public static function getSourceTypeAttr($value,$data){
|
||||
return self::getAcccountDesc($value);
|
||||
|
||||
}
|
||||
|
||||
public static function getcreateTimeAttr($value,$data){
|
||||
if($value){
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
98
application/common/model/Ad.php
Normal file
98
application/common/model/Ad.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class Ad extends Model{
|
||||
const mobile = 1;
|
||||
const pc = 2;
|
||||
|
||||
|
||||
public static function getAdTypeDesc($from = true){
|
||||
$desc = [
|
||||
self::mobile => '移动端商城',
|
||||
self::pc => 'pc端商城',
|
||||
];
|
||||
if($from === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
public static function getLinkPage($type = true,$from = true){
|
||||
$page = [
|
||||
self::mobile => [
|
||||
[
|
||||
'name' => '商品分类',
|
||||
'path' => '/pages/sort/sort',
|
||||
'is_tab' => 1,
|
||||
],
|
||||
[
|
||||
'name' => '领券中心',
|
||||
'path' => '/pages/user_getcoupon/user_getcoupon',
|
||||
'is_tab' => 0,
|
||||
],
|
||||
[
|
||||
'name' => '个人中心',
|
||||
'path' => '/pages/user/user',
|
||||
'is_tab' => 1,
|
||||
],
|
||||
],
|
||||
self::pc => [
|
||||
[
|
||||
'name' => '商品分类',
|
||||
'path' => '/category',
|
||||
'is_tab' => 0,
|
||||
],
|
||||
[
|
||||
'name' => '领券中心',
|
||||
'path' => '/get_coupons',
|
||||
'is_tab' => 0,
|
||||
],
|
||||
[
|
||||
'name' => '个人中心',
|
||||
'path' => '/user/profile',
|
||||
'is_tab' => 0,
|
||||
],
|
||||
],
|
||||
];
|
||||
if(true !== $type){
|
||||
$page = $page[$type] ?? [];
|
||||
}
|
||||
if(true === $from){
|
||||
return $page;
|
||||
}
|
||||
return $page[$from] ?? [];
|
||||
}
|
||||
|
||||
|
||||
public static function getGoodsPath($from = true){
|
||||
$desc = [
|
||||
self::mobile => '/pages/goods_details/goods_details',
|
||||
self::pc => '/goods_details',
|
||||
];
|
||||
if(true === $from){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
117
application/common/model/AfterSale.php
Normal file
117
application/common/model/AfterSale.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AfterSale extends Model
|
||||
{
|
||||
//售后状态
|
||||
const STATUS_APPLY_REFUND = 0;//申请退款
|
||||
const STATUS_REFUSE_REFUND = 1;//商家拒绝
|
||||
const STATUS_WAIT_RETURN_GOODS = 2;//商品待退货
|
||||
const STATUS_WAIT_RECEIVE_GOODS = 3;//商家待收货
|
||||
const STATUS_REFUSE_RECEIVE_GOODS = 4;//商家拒收货
|
||||
const STATUS_WAIT_REFUND = 5;//等待退款
|
||||
const STATUS_SUCCESS_REFUND = 6;//退款成功
|
||||
|
||||
//退款类型
|
||||
const TYPE_ONLY_REFUND = 0;//仅退款
|
||||
const TYPE_REFUND_RETURN = 1;//退款退货
|
||||
|
||||
//售后状态描述
|
||||
public static function getStatusDesc($state)
|
||||
{
|
||||
$data = [
|
||||
self::STATUS_APPLY_REFUND => '申请退款',
|
||||
self::STATUS_REFUSE_REFUND => '商家拒绝',
|
||||
self::STATUS_WAIT_RETURN_GOODS => '商品待退货',
|
||||
self::STATUS_WAIT_RECEIVE_GOODS => '商家待收货',
|
||||
self::STATUS_REFUSE_RECEIVE_GOODS => '商家拒收货',
|
||||
self::STATUS_WAIT_REFUND => '等待退款',
|
||||
self::STATUS_SUCCESS_REFUND => '退款成功',
|
||||
];
|
||||
if ($state === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$state] ?? '';
|
||||
}
|
||||
|
||||
|
||||
//售后类型描述
|
||||
public static function getRefundTypeDesc($type)
|
||||
{
|
||||
$data = [
|
||||
self::TYPE_ONLY_REFUND => '仅退款',
|
||||
self::TYPE_REFUND_RETURN => '退款退货',
|
||||
];
|
||||
if ($type === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$type] ?? '';
|
||||
}
|
||||
|
||||
|
||||
//售后原因
|
||||
public static function getReasonLists()
|
||||
{
|
||||
$data = [
|
||||
'7天无理由退换货',
|
||||
'大小尺寸与商品描述不符',
|
||||
'颜色/图案/款式不符',
|
||||
'做工粗糙/有瑕疵',
|
||||
'质量问题',
|
||||
'卖家发错货',
|
||||
'少件(含缺少配件)',
|
||||
'不喜欢/不想要',
|
||||
'快递/物流一直未送到',
|
||||
'空包裹',
|
||||
'快递/物流无跟踪记录',
|
||||
'货物破损已拒签',
|
||||
'其他',
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function orderGoods()
|
||||
{
|
||||
return $this->hasMany('order_goods', 'id', 'order_goods_id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,mobile,sex,create_time');
|
||||
}
|
||||
|
||||
public function order()
|
||||
{
|
||||
return $this->hasOne('order', 'id', 'order_id')
|
||||
->field('id,order_sn,total_amount,order_amount,pay_way,order_status');
|
||||
}
|
||||
|
||||
|
||||
public function logs()
|
||||
{
|
||||
return $this->hasMany('after_sale_log', 'after_sale_id', 'id')->order('id desc');
|
||||
}
|
||||
}
|
||||
67
application/common/model/AfterSaleLog.php
Normal file
67
application/common/model/AfterSaleLog.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class AfterSaleLog extends Model
|
||||
{
|
||||
//售后操作人类型
|
||||
const TYPE_USER = 0;//会员
|
||||
const TYPE_SHOP = 1;//门店
|
||||
|
||||
//售后动作
|
||||
const USER_APPLY_REFUND = 100;//会员申请售后
|
||||
const USER_SEND_EXPRESS = 101;//会员发快递
|
||||
const USER_CANCEL_REFUND = 102;//会员撤销售后
|
||||
const USER_AGAIN_REFUND = 103;//会员重新提交申请
|
||||
const SHOP_AGREE_REFUND = 104;//商家同意退款
|
||||
const SHOP_REFUSE_REFUND = 105;//商家拒绝退款
|
||||
const SHOP_TAKE_GOODS = 106;//商家收货
|
||||
const SHOP_REFUSE_TAKE_GOODS = 107;//商家拒绝收货
|
||||
const SHOP_CONFIRM_REFUND = 108;//商家确认退款
|
||||
const REFUND_SUCCESS = 109;//退款成功
|
||||
const REFUND_ERROR = 110;//退款失败
|
||||
|
||||
|
||||
//售后动作明细
|
||||
public static function getLogDesc($log)
|
||||
{
|
||||
$desc = [
|
||||
self::USER_APPLY_REFUND => '会员申请退款',
|
||||
self::USER_SEND_EXPRESS => '会员填写退货物流信息',
|
||||
self::USER_CANCEL_REFUND => '会员撤销售后申请',
|
||||
self::USER_AGAIN_REFUND => '会员重新提交申请',
|
||||
self::SHOP_AGREE_REFUND => '商家同意退款',
|
||||
self::SHOP_REFUSE_REFUND => '商家拒绝退款',
|
||||
self::SHOP_TAKE_GOODS => '商家收货',
|
||||
self::SHOP_REFUSE_TAKE_GOODS => '商家拒绝收货',
|
||||
self::SHOP_CONFIRM_REFUND => '商家确认退款',
|
||||
self::REFUND_SUCCESS => '退款成功',
|
||||
self::REFUND_ERROR => '退款失败',
|
||||
];
|
||||
|
||||
if ($log === true){
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return isset($desc[$log]) ? $desc[$log] : $log;
|
||||
}
|
||||
}
|
||||
62
application/common/model/Bargain.php
Normal file
62
application/common/model/Bargain.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 砍价活动模型
|
||||
* Class Bargain
|
||||
* @Author 张无忌
|
||||
* @package app\common\model
|
||||
*/
|
||||
class Bargain extends Model
|
||||
{
|
||||
/**
|
||||
* Notes: 关联商品模型
|
||||
* @author 张无忌(2021/2/23 17:50)
|
||||
*/
|
||||
public function goods()
|
||||
{
|
||||
return $this->hasOne('Goods', 'id', 'goods_id')
|
||||
->field(['id', 'name', 'image', 'max_price', 'min_price']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 关联砍价参与人数
|
||||
* @author 张无忌(2021/2/23 18:06)
|
||||
*/
|
||||
public function launchPeopleNumber()
|
||||
{
|
||||
return $this->hasMany('BargainLaunch', 'bargain_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 关联砍价成功人数
|
||||
* @author 张无忌(2021/2/23 18:11)
|
||||
*/
|
||||
public function successKnifePeopleNumber()
|
||||
{
|
||||
return $this->hasMany('BargainLaunch', 'bargain_id', 'id')
|
||||
->where(['status'=>1]);
|
||||
}
|
||||
}
|
||||
38
application/common/model/BargainItem.php
Normal file
38
application/common/model/BargainItem.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 砍价活动 商品SKU模型
|
||||
* Class BargainItem
|
||||
* @Author 张无忌
|
||||
* @package app\common\model
|
||||
*/
|
||||
class BargainItem extends Model
|
||||
{
|
||||
public function goodsItem()
|
||||
{
|
||||
return $this->hasOne('GoodsItem', 'id', 'item_id');
|
||||
}
|
||||
}
|
||||
40
application/common/model/BargainKnife.php
Normal file
40
application/common/model/BargainKnife.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 砍价活动 助力模型
|
||||
* Class BargainKnife
|
||||
* @Author 张无忌
|
||||
* @package app\common\model
|
||||
*/
|
||||
class BargainKnife extends Model
|
||||
{
|
||||
// 关联用户模型
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
}
|
||||
227
application/common/model/BargainLaunch.php
Normal file
227
application/common/model/BargainLaunch.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\server\UrlServer;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 砍价活动 参与模型
|
||||
* Class BargainLaunch
|
||||
* @Author 张无忌
|
||||
* @package app\common\model
|
||||
*/
|
||||
class BargainLaunch extends Model
|
||||
{
|
||||
protected $json = ['goods_snap','bargain_snap'];
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
const conductStatus = 0; //进行中
|
||||
const successStatus = 1; //成功
|
||||
const failStatus = 2; //失败
|
||||
|
||||
public static function getStatusDesc($type = true)
|
||||
{
|
||||
$desc = [
|
||||
self::conductStatus => '砍价中',
|
||||
self::successStatus => '砍价成功',
|
||||
self::failStatus => '砍价失败',
|
||||
];
|
||||
if ($type === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$type] ?? '未知';
|
||||
}
|
||||
|
||||
// 关联用户模型
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 关联订单模型
|
||||
* @author 张无忌(2021/2/24 15:55)
|
||||
*/
|
||||
public function order()
|
||||
{
|
||||
return $this->hasOne('Order', 'id', 'order_id')
|
||||
->field('id,order_sn,user_id,create_time,order_amount,order_status');
|
||||
}
|
||||
|
||||
public function bargainKnife(){
|
||||
return $this->hasMany('bargain_knife', 'launch_id', 'id');
|
||||
}
|
||||
|
||||
//显示商品价格
|
||||
public function getPriceAttr($value,$data){
|
||||
return $data['goods_snap']['price'];
|
||||
}
|
||||
|
||||
|
||||
//显示商品主图
|
||||
public function getImageAttr($value,$data){
|
||||
return UrlServer::getFileUrl($data['goods_snap']['goods_iamge']);
|
||||
}
|
||||
//显示商品名称
|
||||
public function getNameAttr($value,$data){
|
||||
return $data['goods_snap']['name'];
|
||||
}
|
||||
public function getItemIdAttr($value,$data){
|
||||
return $data['goods_snap']['item_id'];
|
||||
}
|
||||
//显示规格名称
|
||||
public function getSpecValueStrAttr($value,$data){
|
||||
return $data['goods_snap']['spec_value_str'];
|
||||
}
|
||||
public function getBtnTipsAttr($value,$data){
|
||||
$tips = '';
|
||||
if(1 == $data['status']){
|
||||
$tips = '砍价成功';
|
||||
}else if(0 == $data['status']){
|
||||
$tips = '继续砍价';
|
||||
}
|
||||
return $tips;
|
||||
}
|
||||
// //显示直接购买按钮
|
||||
// public function getBuyBtnAttr($value,$data){
|
||||
// $btn = 0;
|
||||
// if(2 == $data['bargain_snap']['payment_where'] && empty($data['order_id'])){
|
||||
// $btn = 1;
|
||||
// }
|
||||
// return $btn;
|
||||
// }
|
||||
//显示查看订单按钮
|
||||
public function getOrderBtnAttr($value,$data){
|
||||
$btn = 0;
|
||||
if($data['order_id']){
|
||||
$btn = 1;
|
||||
}
|
||||
return $btn;
|
||||
}
|
||||
//继续砍价按钮
|
||||
public function getBargainBtnAttr($value,$data){
|
||||
$btn = 0;
|
||||
if(0 == $data['status']){
|
||||
$btn = 1;
|
||||
}
|
||||
return $btn;
|
||||
}
|
||||
//砍价成功按钮
|
||||
public function getSuccessBtnAttr($value,$data){
|
||||
$btn = 0;
|
||||
if(1 == $data['status']){
|
||||
$btn = 1;
|
||||
}
|
||||
return $btn;
|
||||
}
|
||||
|
||||
//显示去支付按钮
|
||||
public function getPayBtnAttr($value,$data){
|
||||
$btn = 0;
|
||||
if(1 == $data['status']){
|
||||
$btn = 1;
|
||||
}
|
||||
return $btn;
|
||||
}
|
||||
|
||||
//显示砍价提示
|
||||
public function getBargainTipsAttr($value,$data){
|
||||
$tips = '须砍至最低价才可支付购买';
|
||||
if(2 == $data['bargain_snap']['payment_where']){
|
||||
$tips = '砍至任意金额可直接购买';
|
||||
}
|
||||
return $tips;
|
||||
}
|
||||
|
||||
//显示状态
|
||||
public function getStatusTextAttr($value,$data){
|
||||
return static::getStatusDesc($data['status']);
|
||||
}
|
||||
|
||||
//发起砍价时间
|
||||
public function getCreateTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$data['launch_start_time']);
|
||||
}
|
||||
|
||||
//砍价结束时间
|
||||
public function getOverTimeAttr($value,$data){
|
||||
return $data['launch_end_time'];
|
||||
}
|
||||
|
||||
//剩余的差价
|
||||
public function getDiffPriceAttr($value,$data){
|
||||
return round($data['current_price'] - $data['bargain_price'],2);
|
||||
}
|
||||
|
||||
//已砍价的价格
|
||||
public function getKnifePriceAttr($value,$data){
|
||||
return round($data['goods_snap']['price'] - $data['current_price'],2);
|
||||
}
|
||||
|
||||
//砍价进度条
|
||||
public function getProgressAttr($value,$data){
|
||||
return round($data['bargain_price'] / $data['current_price'],2);
|
||||
}
|
||||
|
||||
//活动价
|
||||
public function getActivityPriceAttr($value,$data){
|
||||
return $data['bargain_snap']['floor_price'];
|
||||
}
|
||||
//显示砍价状态提示
|
||||
public function getStatusTipsAttr($value,$data){
|
||||
if(2 == $data['status']){
|
||||
return '非常遗憾,砍价失败了';
|
||||
}
|
||||
if(1 == $data['status']){
|
||||
return '恭喜您,砍价成功';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
//显示用户信息
|
||||
public function getKnifeListAttr($value,$data){
|
||||
$list = [];
|
||||
foreach ($this->bargain_knife as $knife){
|
||||
|
||||
$list[] = [
|
||||
'id' => $knife['id'],
|
||||
'user_id' => $knife['user']['id'],
|
||||
'nickname' => $knife['user']['nickname'],
|
||||
'avatar' => $knife['user']['avatar'],
|
||||
'help_price' => $knife['help_price'],
|
||||
'help_time' => date('Y-m-d H:i:s',$knife['help_time']),
|
||||
];
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
//分享标题
|
||||
public function getShareTitlesAttr($value,$data){
|
||||
return $data['bargain_snap']['share_title'];
|
||||
}
|
||||
|
||||
//分享简介
|
||||
public function getShareIntrosAttr($value,$data){
|
||||
return $data['bargain_snap']['share_intro'];
|
||||
}
|
||||
}
|
||||
30
application/common/model/Capital_.php
Normal file
30
application/common/model/Capital_.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class Capital_
|
||||
{
|
||||
public static function getData()
|
||||
{
|
||||
return range('A','Z');
|
||||
}
|
||||
}
|
||||
74
application/common/model/Client_.php
Normal file
74
application/common/model/Client_.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class Client_
|
||||
{
|
||||
const mnp = 1;//小程序
|
||||
const oa = 2;//公众号
|
||||
const ios = 3;
|
||||
const android = 4;
|
||||
const pc = 5;
|
||||
const h5 = 6;//h5(非微信环境h5)
|
||||
const tt = 8;//头条
|
||||
|
||||
function getName($value)
|
||||
{
|
||||
switch ($value) {
|
||||
case self::mnp:
|
||||
$name = '小程序';
|
||||
break;
|
||||
case self::h5:
|
||||
$name = 'h5';
|
||||
break;
|
||||
case self::ios:
|
||||
$name = '苹果';
|
||||
break;
|
||||
case self::android:
|
||||
$name = '安卓';
|
||||
break;
|
||||
case self::oa:
|
||||
$name = '公众号';
|
||||
break;
|
||||
case self::tt:
|
||||
$name = 'h5';
|
||||
break;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
public static function getClient($type = true)
|
||||
{
|
||||
$desc = [
|
||||
self::pc => 'pc商城',
|
||||
self::h5 => 'h5商城',
|
||||
self::oa => '公众号商城',
|
||||
self::mnp => '小程序商城',
|
||||
self::ios => '苹果APP商城',
|
||||
self::android => '安卓APP商城',
|
||||
];
|
||||
if ($type === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$type] ?? '未知';
|
||||
}
|
||||
}
|
||||
30
application/common/model/Crontab_.php
Normal file
30
application/common/model/Crontab_.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class Crontab_
|
||||
{
|
||||
public static $type = [
|
||||
1=>'定时任务',
|
||||
//2=>'守护进程'
|
||||
];
|
||||
}
|
||||
32
application/common/model/DevMessage.php
Normal file
32
application/common/model/DevMessage.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class DevMessage extends Model{
|
||||
//需要验证码的短信key
|
||||
const CODE_KEY = [
|
||||
'ZCYZ', //注册验证
|
||||
'ZHMM', //找回密码
|
||||
'YZMDL', //验证码登录
|
||||
'BGSJHM', //变更手机号码
|
||||
'BDSJHM', //绑定手机号码
|
||||
'ZHZFMM', //找回支付密码
|
||||
];
|
||||
}
|
||||
53
application/common/model/DistributionMember.php
Normal file
53
application/common/model/DistributionMember.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 分销会员
|
||||
* Class DistributionMember
|
||||
* @package app\common\model
|
||||
*/
|
||||
class DistributionMember extends Model
|
||||
{
|
||||
protected $name = 'distribution_member_apply';
|
||||
|
||||
//分销会员申请状态
|
||||
const STATUS_WAIT_AUDIT = 0; //待审核
|
||||
const STATUS_AUDIT_SUCCESS = 1; //审核通过
|
||||
const STATUS_AUDIT_ERROR = 2; //审核拒绝
|
||||
|
||||
|
||||
//分销会员申请状态
|
||||
public static function getApplyStatus($status = true)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_WAIT_AUDIT => '待审核',
|
||||
self::STATUS_AUDIT_SUCCESS => '审核通过',
|
||||
self::STATUS_AUDIT_ERROR => '审核拒绝',
|
||||
];
|
||||
if ($status === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$status] ?? '未知';
|
||||
}
|
||||
}
|
||||
78
application/common/model/DistributionOrder.php
Normal file
78
application/common/model/DistributionOrder.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 分销订单
|
||||
* Class DistributionOrder
|
||||
* @package app\common\model
|
||||
*/
|
||||
class DistributionOrder extends Model
|
||||
{
|
||||
protected $name = 'distribution_order_goods';
|
||||
|
||||
//分销订单状态
|
||||
const STATUS_WAIT_HANDLE = 1;//待返佣
|
||||
const STATUS_SUCCESS = 2;//已结算
|
||||
const STATUS_ERROR = 3;//已失效
|
||||
|
||||
|
||||
//分销订单状态
|
||||
public static function getOrderStatus($status = true)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_WAIT_HANDLE => '待返佣',
|
||||
self::STATUS_SUCCESS => '已结算',
|
||||
self::STATUS_ERROR => '已失效',
|
||||
];
|
||||
if ($status === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$status] ?? '未知';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 更新指定分佣订单状态
|
||||
* @param $distribution_id
|
||||
* @param $status
|
||||
* @author 段誉(2021/4/23 10:10)
|
||||
* @return DistributionOrder
|
||||
*/
|
||||
public static function updateOrderStatus($distribution_id, $status)
|
||||
{
|
||||
return self::where('id', $distribution_id)
|
||||
->update([
|
||||
'status' => $status,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
//用户
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
|
||||
}
|
||||
30
application/common/model/File.php
Normal file
30
application/common/model/File.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
class File
|
||||
{
|
||||
const type_other = 0;//其他
|
||||
const type_image = 1;//图片
|
||||
const type_video = 2;//视频
|
||||
|
||||
}
|
||||
151
application/common/model/FileCate.php
Normal file
151
application/common/model/FileCate.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class FileCate extends Model
|
||||
{
|
||||
public static function getTreeMenu($get)
|
||||
{
|
||||
$field = 'id,name,pid,level,sort';
|
||||
switch($get['type']) {
|
||||
case 'video':
|
||||
$where = [
|
||||
'del' => 0,
|
||||
'partner_id' => $get['partner_id'],
|
||||
'type' => self::getTypeNumber($get['type'])
|
||||
];
|
||||
$menu = self::where($where)->order('sort', 'desc')->select()->toArray();
|
||||
break;
|
||||
}
|
||||
return self::formatTreeMenu($menu);
|
||||
}
|
||||
|
||||
public static function getMenu($get)
|
||||
{
|
||||
$field = 'id,name,pid,level,sort';
|
||||
switch($get['type']) {
|
||||
case 'video':
|
||||
$where = [
|
||||
'del' => 0,
|
||||
'partner_id' => $get['partner_id'],
|
||||
'type' => self::getTypeNumber($get['type'])
|
||||
];
|
||||
$menu = self::field($field)->where($where)->order('sort', 'desc')->select()->toArray();
|
||||
break;
|
||||
}
|
||||
return self::formatMenu($menu);
|
||||
}
|
||||
|
||||
public static function getTypeNumber($type)
|
||||
{
|
||||
switch($type) {
|
||||
case 'image':
|
||||
return 1;
|
||||
case 'video':
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function formatMenu($menu)
|
||||
{
|
||||
$tree = [];
|
||||
foreach($menu as $item) {
|
||||
// 查找一级分类
|
||||
if($item['pid'] != 0) {
|
||||
continue;
|
||||
}
|
||||
$tree[$item['id']] = '|__'.$item['name'];
|
||||
// 查找二级分类
|
||||
foreach($menu as $subItem) {
|
||||
if($subItem['pid'] == $item['id']) {
|
||||
$tree[$subItem['id']] = '|____'.$subItem['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
public static function formatTreeMenu($menu)
|
||||
{
|
||||
// [{
|
||||
// title: '江西' //一级菜单
|
||||
// ,children: [{
|
||||
// title: '南昌' //二级菜单
|
||||
// ,children: [{
|
||||
// title: '高新区' //三级菜单
|
||||
// //…… //以此类推,可无限层级
|
||||
// }]
|
||||
// }]
|
||||
// },{
|
||||
// title: '陕西' //一级菜单
|
||||
// ,children: [{
|
||||
// title: '西安' //二级菜单
|
||||
// }]
|
||||
// }]
|
||||
$tree = [];
|
||||
$i = 0;
|
||||
foreach($menu as $item) {
|
||||
// 查找一级分类
|
||||
if($item['pid'] != 0) {
|
||||
continue;
|
||||
}
|
||||
$tree[$i]["id"] = $item['id'];
|
||||
$tree[$i]["title"] = $item['name'];
|
||||
$tree[$i]["spread"] = true;
|
||||
$tree[$i]["children"] = [];
|
||||
// 查找二级分类
|
||||
$j = 0;
|
||||
foreach($menu as $subItem) {
|
||||
if($subItem['pid'] == $item['id']) {
|
||||
$tree[$i]["children"][$j]["id"] = $subItem['id'];
|
||||
$tree[$i]["children"][$j]["title"] = $subItem['name'];
|
||||
$tree[$i]["children"][$j]["spread"] = true;
|
||||
$tree[$i]["children"][$j]["children"] = [];
|
||||
// 查找三级分类
|
||||
$k = 0;
|
||||
foreach($menu as $thirdItem) {
|
||||
if($thirdItem['pid'] == $subItem['id']) {
|
||||
$tree[$i]["children"][$j]["children"][$k]["id"] = $thirdItem['id'];
|
||||
$tree[$i]["children"][$j]["children"][$k]["title"] = $thirdItem['name'];
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
|
||||
public static function getCateById($id)
|
||||
{
|
||||
$cate = FileCate::field('id,name,pid,sort')->where(['del'=>0, 'id'=>$id])->findOrEmpty();
|
||||
if($cate->isEmpty()) {
|
||||
return [];
|
||||
}
|
||||
return $cate->toArray();
|
||||
}
|
||||
}
|
||||
54
application/common/model/Footprint.php
Normal file
54
application/common/model/Footprint.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Footprint extends Model
|
||||
{
|
||||
const enter_mall = 1;
|
||||
const browse_goods = 2;
|
||||
const add_cart = 3;
|
||||
const receive_coupon = 4;
|
||||
const place_order = 5;
|
||||
|
||||
public static function getText($value)
|
||||
{
|
||||
$name = '';
|
||||
switch ($value) {
|
||||
case self::enter_mall:
|
||||
$name = '访问商城';
|
||||
break;
|
||||
case self::browse_goods:
|
||||
$name = '浏览商品';
|
||||
break;
|
||||
case self::add_cart:
|
||||
$name = '加入购物车';
|
||||
break;
|
||||
case self::receive_coupon:
|
||||
$name = '领取优惠券';
|
||||
break;
|
||||
case self::place_order:
|
||||
$name = '下单结算';
|
||||
break;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
111
application/common/model/FootprintRecord.php
Normal file
111
application/common/model/FootprintRecord.php
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
use function GuzzleHttp\Psr7\str;
|
||||
|
||||
class FootprintRecord extends Model
|
||||
{
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
/**
|
||||
* Notes: 关联用户模型
|
||||
* @author 张无忌(2020/12/17 11:51)
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('User', 'id', 'user_id')
|
||||
->field(['id', 'nickname', 'avatar']);
|
||||
}
|
||||
|
||||
public function getTimeAttr($value, $data)
|
||||
{
|
||||
// 足迹记录时间
|
||||
$create_time = $data['create_time'];
|
||||
// 一小时前时间戳
|
||||
$an_hour_ago = strtotime("-1 hour");
|
||||
|
||||
// 小于1小时内显示xx分钟, 否则显示多少个小时
|
||||
if ($create_time > $an_hour_ago) {
|
||||
$minute = intval((time() - $create_time) / 60);
|
||||
return $minute <= 0 ? '刚刚' : strval($minute).'分钟前';
|
||||
} else {
|
||||
return '1小时前';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取30分钟内容的足迹
|
||||
* @param $data
|
||||
* @return FootprintRecord
|
||||
* @author 张无忌(2020/12/16 18:17)
|
||||
*/
|
||||
public static function getFootPrintOneHourInner($data)
|
||||
{
|
||||
// 一小时前时间戳
|
||||
$an_hour_ago = strtotime("-1 hour");
|
||||
// 30分钟前时间戳
|
||||
$half_an_hour_ago = $an_hour_ago + 1800;
|
||||
// 当前时间戳
|
||||
$current_time = time();
|
||||
|
||||
$where = [
|
||||
['create_time', '>', $half_an_hour_ago],
|
||||
['create_time', '<', $current_time]
|
||||
];
|
||||
if ($data['type']) {
|
||||
$where[] = ['user_id', '=', (int)$data['user_id']];
|
||||
$where[] = ['type', '=', (int)$data['type']];
|
||||
}
|
||||
|
||||
// 进入商城
|
||||
if ($data['type'] === Footprint::enter_mall) {
|
||||
$where[] = ['foreign_id', '=', 0];
|
||||
}
|
||||
|
||||
// 如果是浏览器商品
|
||||
if ($data['type'] === Footprint::browse_goods) {
|
||||
$where[] = ['foreign_id', '=', (int)$data['foreign_id']];
|
||||
}
|
||||
|
||||
$model = new self;
|
||||
return $model->field(true)->where($where)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 添加足迹记录
|
||||
* @param $data (数据)
|
||||
* @param $tpl
|
||||
* @return FootprintRecord
|
||||
* @author 张无忌(2020/12/16 18:18)
|
||||
*/
|
||||
public static function add($data, $tpl)
|
||||
{
|
||||
return self::create([
|
||||
'type' => $data['type'],
|
||||
'user_id' => $data['user_id'],
|
||||
'foreign_id' => empty($data['foreign_id']) ? 0 : $data['foreign_id'],
|
||||
'template' => $tpl,
|
||||
'create_time' => time(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
62
application/common/model/Freight.php
Normal file
62
application/common/model/Freight.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Freight extends Model
|
||||
{
|
||||
protected $name = 'freight';
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
//计费方式
|
||||
const CHARGE_WAY_WEIGHT = 1;//按重量计费
|
||||
const CHARGE_WAY_VOLUME = 2; //体积计费
|
||||
const CHARGE_WAY_PIECE = 3;//按件计费
|
||||
|
||||
|
||||
public static function getChargeWay($type)
|
||||
{
|
||||
$data = [
|
||||
self::CHARGE_WAY_WEIGHT => '按重量计费',
|
||||
self::CHARGE_WAY_VOLUME => '按体积计费',
|
||||
self::CHARGE_WAY_PIECE => '按件计费',
|
||||
];
|
||||
|
||||
if ($type === true) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
return $data[$type] ?? '未知';
|
||||
}
|
||||
|
||||
public function getChargeWayTextAttr($value, $data)
|
||||
{
|
||||
return self::getChargeWay($data['charge_way']);
|
||||
}
|
||||
|
||||
|
||||
public function configs()
|
||||
{
|
||||
return $this->hasMany('freight_config', 'freight_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
30
application/common/model/FreightConfig.php
Normal file
30
application/common/model/FreightConfig.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class FreightConfig extends Model
|
||||
{
|
||||
protected $name = 'freight_config';
|
||||
|
||||
protected $autoWriteTimestamp = true;
|
||||
|
||||
}
|
||||
63
application/common/model/Goods.php
Normal file
63
application/common/model/Goods.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class Goods extends Model
|
||||
{
|
||||
/**
|
||||
* User: 意象信息科技 mjf
|
||||
* Desc: 获取以规格id为键的商品信息
|
||||
* @param string $field
|
||||
* @return array
|
||||
*/
|
||||
public static function getColumnGoods($field = '*')
|
||||
{
|
||||
$info = Db::name('goods_item i')
|
||||
->join('goods g', 'g.id = i.goods_id')
|
||||
->column($field, 'i.id');
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
/**
|
||||
* User: 意象信息科技 mjf
|
||||
* Desc: 通过规格id获取商品信息
|
||||
* @param $item_id
|
||||
* @param string $field
|
||||
* @return array|\PDOStatement|string|Model|null
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function getOneByItem($item_id, $field = '*')
|
||||
{
|
||||
$info = Db::name('goods_item i')
|
||||
->field($field)
|
||||
->join('goods g', 'g.id = i.goods_id')
|
||||
->where('i.id', $item_id)
|
||||
->find();
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
}
|
||||
29
application/common/model/GoodsItem.php
Normal file
29
application/common/model/GoodsItem.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class GoodsItem extends Model
|
||||
{
|
||||
|
||||
}
|
||||
11
application/common/model/Luckdraw.php
Normal file
11
application/common/model/Luckdraw.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Luckdraw extends Model
|
||||
{
|
||||
|
||||
}
|
||||
26
application/common/model/LuckdrawRecord.php
Normal file
26
application/common/model/LuckdrawRecord.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 抽奖记录模型
|
||||
* Class LuckDrawRecord
|
||||
* @package app\common\model
|
||||
*/
|
||||
class LuckdrawRecord extends Model
|
||||
{
|
||||
// 关联用户模型
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
|
||||
public function getCreateTimeAttr($value)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
}
|
||||
243
application/common/model/Menu_.php
Normal file
243
application/common/model/Menu_.php
Normal file
@@ -0,0 +1,243 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
class Menu_{
|
||||
/*
|
||||
* 首页菜单
|
||||
*/
|
||||
const index_seckill = 1;
|
||||
const index_team_activity = 2;
|
||||
const index_hot_sell = 3;
|
||||
const index_coupon_list = 4;
|
||||
const index_sign_in = 5;
|
||||
const index_member_centre = 6;
|
||||
const index_my_collect = 7;
|
||||
const index_store_news = 8;
|
||||
const index_store_help = 9;
|
||||
const index_delivery_address = 10;
|
||||
const index_goods_category = 11;
|
||||
const index_luckdraw = 12;
|
||||
const index_bargain = 13;
|
||||
/*
|
||||
* 个人中心菜单
|
||||
*/
|
||||
const centre_my_wallet = 10;
|
||||
const centre_generalize = 11;
|
||||
const centre_my_coupon = 12;
|
||||
const centre_level_serve = 13;
|
||||
const centre_store_help = 14;
|
||||
const centre_delivery_address = 15;
|
||||
const centre_my_collect = 16;
|
||||
const centre_service = 17;
|
||||
const centre_team_activity = 18;
|
||||
const centre_bargain = 19;
|
||||
|
||||
/**
|
||||
* Notes: 菜单内容
|
||||
* @param bool $scene 场景:1-首页导航;2-个人中心
|
||||
* @param bool $from 菜单来源:获取具体的某个菜单
|
||||
* @return array
|
||||
* name => '菜单名称'
|
||||
* link => 调整链接
|
||||
* is_tab => 是否的tab页
|
||||
* link_type => 菜单类型:1-跳转;2-web-view;3-按钮(微信小程序可调用客服)
|
||||
* menu_type => 菜单内容类型:1-正常内容;2-分销菜单
|
||||
*
|
||||
*/
|
||||
public static function getMenuContent($scene = true,$from = true){
|
||||
//首页菜单
|
||||
$config1 = [
|
||||
self::index_seckill => [
|
||||
'name' => '限时秒杀',
|
||||
'link' => '/pages/bundle/goods_seckill/goods_seckill',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_team_activity => [
|
||||
'name' => '拼团活动',
|
||||
'link' => '/pages/bundle/goods_combination/goods_combination',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_hot_sell => [
|
||||
'name' => '热销榜单',
|
||||
'link' => '/pages/bundle/hot_list/hot_list',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_coupon_list => [
|
||||
'name' => '领券中心',
|
||||
'link' => '/pages/user_getcoupon/user_getcoupon',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_sign_in => [
|
||||
'name' => '积分签到',
|
||||
'link' => '/pages/bundle/user_sign/user_sign',
|
||||
'is_tab' => 0,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_member_centre => [
|
||||
'name' => '会员中心',
|
||||
'link' => '/pages/user_vip/user_vip',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_my_collect => [
|
||||
'name' => '我的收藏',
|
||||
'link' => '/pages/user_collection/user_collection',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_store_news => [
|
||||
'name' => '商城资讯',
|
||||
'link' => '/pages/news_list/news_list',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_store_help => [
|
||||
'name' => '帮助中心',
|
||||
'link' => '/pages/news_list/news_list?type=1',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_delivery_address => [
|
||||
'name' => '收货地址',
|
||||
'link' => '/pages/user_address/user_address',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_goods_category => [
|
||||
'name' => '商品分类',
|
||||
'link' => '/pages/sort/sort',
|
||||
'is_tab' => 1,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_luckdraw => [
|
||||
'name' => '积分抽奖',
|
||||
'link' => '/pages/bundle/luckly_wheel/luckly_wheel',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_bargain => [
|
||||
'name' => '砍价活动',
|
||||
'link' => '/pages/bundle/bargain/bargain',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
];
|
||||
//个人中心菜单
|
||||
$config2 = [
|
||||
self::centre_my_wallet => [
|
||||
'name' => '我的钱包',
|
||||
'link' => '/pages/bundle/user_wallet/user_wallet',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_generalize => [
|
||||
'name' => '分销推广',
|
||||
'link' => '/pages/bundle/user_spread/user_spread',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 2,
|
||||
],
|
||||
self::centre_my_coupon => [
|
||||
'name' => '我的优惠券',
|
||||
'link' => '/pages/user_coupon/user_coupon',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_level_serve => [
|
||||
'name' => '等级服务',
|
||||
'link' => '/pages/user_vip/user_vip',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_store_help => [
|
||||
'name' => '帮助中心',
|
||||
'link' => '/pages/news_list/news_list?type=1',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_delivery_address => [
|
||||
'name' => '收货地址',
|
||||
'link' => '/pages/user_address/user_address',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_my_collect => [
|
||||
'name' => '我的收藏',
|
||||
'link' => '/pages/user_collection/user_collection',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_service => [
|
||||
'name' => '联系客服',
|
||||
'link' => '/pages/bundle/contact_offical/contact_offical',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_team_activity => [
|
||||
'name' => '我的拼团',
|
||||
'link' => '/pages/bundle/user_group/user_group',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_bargain => [
|
||||
'name' => '砍价记录',
|
||||
'link' => '/pages/bundle/bargain_code/bargain_code',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
];
|
||||
$config_name = 'config'.$scene;
|
||||
$content = $$config_name;
|
||||
if($scene === true){
|
||||
$content = array_merge($config1,$config2);
|
||||
}
|
||||
if($from === true){
|
||||
return $content;
|
||||
}
|
||||
return $content[$from] ?? [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
49
application/common/model/MessageScene_.php
Normal file
49
application/common/model/MessageScene_.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 微信/公众号的消息模板场景
|
||||
* Class MessageScene_
|
||||
* @package app\common\model
|
||||
*/
|
||||
class MessageScene_
|
||||
{
|
||||
const BUY_SUCCESS = 1; //购买成功通知
|
||||
const DELIVER_GOODS_SUCCESS = 2; //商品发货通知
|
||||
const REFUND_SUCCESS = 3; //退款成功通知
|
||||
|
||||
function getName($value)
|
||||
{
|
||||
$name = '';
|
||||
switch ($value) {
|
||||
case self::BUY_SUCCESS:
|
||||
$name = '购买成功通知';
|
||||
break;
|
||||
case self::DELIVER_GOODS_SUCCESS:
|
||||
$name = '商品发货通知';
|
||||
break;
|
||||
case self::REFUND_SUCCESS:
|
||||
$name = '退款成功通知';
|
||||
break;
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
269
application/common/model/NoticeSetting.php
Normal file
269
application/common/model/NoticeSetting.php
Normal file
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 通知场景
|
||||
* Class Notice
|
||||
* @package app\common\model
|
||||
*/
|
||||
class NoticeSetting extends Model
|
||||
{
|
||||
|
||||
protected $name = 'dev_notice_setting';
|
||||
|
||||
//设置json
|
||||
// protected $json = ['variable', 'system_notice', 'sms_notice', 'oa_notice', 'mnp_notice'];
|
||||
// protected $jsonAssoc = true;
|
||||
|
||||
|
||||
//通知类型
|
||||
const SYSTEM_NOTICE = 1;
|
||||
const SMS_NOTICE = 2;
|
||||
const OA_NOTICE = 3;
|
||||
const MNP_NOTICE = 4;
|
||||
|
||||
|
||||
//通知对象
|
||||
const NOTICE_PLATFORM = 1; //通知平台
|
||||
const NOTICE_USER = 2; //通知会员
|
||||
const NOTICE_OTHER = 3; //通知游客(如新用户注册)
|
||||
|
||||
|
||||
//通知会员
|
||||
const ORDER_PAY_NOTICE = 100;//订单已支付
|
||||
const ORDER_DELIVERY_NOTICE = 101;//订单已发货
|
||||
const PLATFORM_PASS_REFUND_NOTICE = 102;//平台通过售后退款通知
|
||||
const PLATFORM_REFUSE_REFUND_NOTICE = 103;//平台拒绝售后退款通知
|
||||
const REGISTER_NOTICE = 104;//注册通知
|
||||
const CHANGE_MOBILE_NOTICE = 105;//变更手机号短信通知
|
||||
const GET_BACK_MOBILE_NOTICE = 106;//重置密码短信通知
|
||||
const REGISTER_SUCCESS_NOTICE = 107;//注册成功
|
||||
const INVITE_SUCCESS_NOTICE = 108;//邀请成功
|
||||
const GET_EARNINGS_NOTICE = 109;//获得收益
|
||||
const GET_GODE_LOGIN_NOTICE = 110;//验证码登录
|
||||
const BIND_MOBILE_NOTICE = 111;//绑定手机号
|
||||
const GET_BACK_PAY_CODE_NOTICE = 112;//找回支付密码
|
||||
|
||||
|
||||
//通知平台
|
||||
const USER_PAID_NOTICE_PLATFORM = 200;//会员支付下单通知平台
|
||||
const AFTER_SALE_NOTICE_PLATFORM = 201;//会员发起售后退款通知
|
||||
|
||||
|
||||
|
||||
//订单相关场景
|
||||
const ORDER_SCENE = [
|
||||
self::ORDER_PAY_NOTICE,
|
||||
self::ORDER_DELIVERY_NOTICE,
|
||||
self::PLATFORM_PASS_REFUND_NOTICE,
|
||||
self::PLATFORM_REFUSE_REFUND_NOTICE,
|
||||
];
|
||||
|
||||
|
||||
//通知平台的场景
|
||||
const NOTICE_PLATFORM_SCENE = [
|
||||
self::USER_PAID_NOTICE_PLATFORM,
|
||||
self::AFTER_SALE_NOTICE_PLATFORM,
|
||||
];
|
||||
|
||||
|
||||
//通知会员的场景
|
||||
const NOTICE_USER_SCENE = [
|
||||
self::ORDER_PAY_NOTICE,
|
||||
self::ORDER_DELIVERY_NOTICE,
|
||||
self::PLATFORM_PASS_REFUND_NOTICE,
|
||||
self::PLATFORM_REFUSE_REFUND_NOTICE,
|
||||
self::CHANGE_MOBILE_NOTICE,
|
||||
self::GET_BACK_MOBILE_NOTICE,
|
||||
self::REGISTER_SUCCESS_NOTICE,
|
||||
self::INVITE_SUCCESS_NOTICE,
|
||||
self::GET_EARNINGS_NOTICE,
|
||||
];
|
||||
|
||||
//通知游客(还不存在当前系统的人)
|
||||
const NOTICE_OTHER_SCENE = [
|
||||
self::REGISTER_NOTICE
|
||||
];
|
||||
|
||||
|
||||
//验证码的场景
|
||||
const NOTICE_NEED_CODE = [
|
||||
self::REGISTER_NOTICE,
|
||||
self::CHANGE_MOBILE_NOTICE,
|
||||
self::GET_BACK_MOBILE_NOTICE,
|
||||
self::GET_GODE_LOGIN_NOTICE,
|
||||
self::BIND_MOBILE_NOTICE,
|
||||
self::GET_BACK_PAY_CODE_NOTICE,
|
||||
];
|
||||
|
||||
|
||||
//场景值-兼容旧短信场景逻辑
|
||||
const SMS_SCENE = [
|
||||
'DDZFTZ' => self::ORDER_PAY_NOTICE,
|
||||
'DDFHTZ' => self::ORDER_DELIVERY_NOTICE,
|
||||
'SJTYSHTK' => self::PLATFORM_PASS_REFUND_NOTICE,
|
||||
'SJJJSHTK' => self::PLATFORM_REFUSE_REFUND_NOTICE,
|
||||
'ZCYZ' => self::REGISTER_NOTICE,
|
||||
'ZHMM' => self::GET_BACK_MOBILE_NOTICE,
|
||||
'DDTZ' => self::USER_PAID_NOTICE_PLATFORM,
|
||||
'SHTKDDTZ' => self::AFTER_SALE_NOTICE_PLATFORM,
|
||||
'YZMDL' => self::GET_GODE_LOGIN_NOTICE,
|
||||
'BGSJHM' => self::CHANGE_MOBILE_NOTICE,
|
||||
'BDSJHM' => self::BIND_MOBILE_NOTICE,
|
||||
'ZHZFMM' => self::GET_BACK_PAY_CODE_NOTICE,
|
||||
];
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 获取场景描述
|
||||
* @param $state
|
||||
* @return array|mixed|string
|
||||
* @author 段誉(2021/4/26 16:15)
|
||||
*/
|
||||
public static function getSceneDesc($state)
|
||||
{
|
||||
$data = [
|
||||
self::ORDER_PAY_NOTICE => '订单已支付',
|
||||
self::ORDER_DELIVERY_NOTICE => '订单已发货',
|
||||
self::PLATFORM_PASS_REFUND_NOTICE => '平台通过售后退款通知',
|
||||
self::PLATFORM_REFUSE_REFUND_NOTICE => '平台拒绝售后退款通知',
|
||||
self::REGISTER_NOTICE => '注册通知',
|
||||
self::CHANGE_MOBILE_NOTICE => '变更手机号短信通知',
|
||||
self::GET_BACK_MOBILE_NOTICE => '重置密码短信通知',
|
||||
self::REGISTER_SUCCESS_NOTICE => '注册成功',
|
||||
self::INVITE_SUCCESS_NOTICE => '邀请成功',
|
||||
self::GET_EARNINGS_NOTICE => '获得收益',
|
||||
self::GET_GODE_LOGIN_NOTICE => '验证码登录',
|
||||
self::BIND_MOBILE_NOTICE => '绑定手机号',
|
||||
self::GET_BACK_PAY_CODE_NOTICE => '找回支付密码',
|
||||
|
||||
self::USER_PAID_NOTICE_PLATFORM => '会员支付下单通知平台',
|
||||
self::AFTER_SALE_NOTICE_PLATFORM => '会员发起售后退款通知',
|
||||
];
|
||||
if ($state === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$state] ?? '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 根据场景获取跳转地址
|
||||
* @param $scene
|
||||
* @author 段誉(2021/4/27 17:01)
|
||||
* @return array
|
||||
*/
|
||||
public static function getPathByScene($scene, $extra_id)
|
||||
{
|
||||
$page = '/pages/index/index'; // 小程序主页路径
|
||||
$url = '/mobile/pages/index/index'; // 公众号主页路径
|
||||
if (in_array($scene, self::ORDER_SCENE)) {
|
||||
$url = '/mobile/pages/order_details/order_details?id='.$extra_id;
|
||||
$page = '/pages/order_details/order_details?id='.$extra_id;
|
||||
}
|
||||
return ['url' => $url, 'page' => $page];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 场景名称
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @author 段誉(2021/4/26 16:56)
|
||||
* @return array|mixed|string
|
||||
*/
|
||||
public function getSceneAttr($value, $data)
|
||||
{
|
||||
return self::getSceneDesc($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 场景变量
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @author 段誉(2021/4/26 17:07)
|
||||
* @return mixed
|
||||
*/
|
||||
public function getVariableAttr($value, $data)
|
||||
{
|
||||
return $this->jsonToArr($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 系统消息
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @author 段誉(2021/4/26 17:18)
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getSystemNoticeAttr($value, $data)
|
||||
{
|
||||
return $this->jsonToArr($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 短信消息
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @author 段誉(2021/4/26 17:25)
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getSmsNoticeAttr($value, $data)
|
||||
{
|
||||
return $this->jsonToArr($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes: 公众号消息
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @author 段誉(2021/4/26 17:25)
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getOaNoticeAttr($value, $data)
|
||||
{
|
||||
return $this->jsonToArr($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 小程序消息
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @author 段誉(2021/4/26 17:25)
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function getMnpNoticeAttr($value, $data)
|
||||
{
|
||||
return $this->jsonToArr($value);
|
||||
}
|
||||
|
||||
|
||||
public function jsonToArr($data)
|
||||
{
|
||||
return empty($data) ? [] : json_decode($data, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
}
|
||||
183
application/common/model/Order.php
Normal file
183
application/common/model/Order.php
Normal file
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
protected $name = 'order';
|
||||
|
||||
//订单类型
|
||||
const NORMAL_ORDER = 0;//普通订单
|
||||
const SECKILL_ORDER = 1;//秒杀订单
|
||||
const TEAM_ORDER = 2;//拼团订单
|
||||
const BARGAIN_ORDER = 3;//砍价订单
|
||||
|
||||
//订单状态
|
||||
const STATUS_WAIT_PAY = 0; //待付款
|
||||
const STATUS_WAIT_DELIVERY = 1; //待发货
|
||||
const STATUS_WAIT_RECEIVE = 2; //待收货
|
||||
const STATUS_FINISH = 3; //已完成
|
||||
const STATUS_CLOSE = 4; //已关闭
|
||||
|
||||
//配送方式
|
||||
const DELIVERY_STATUS_EXPRESS = 1;//快递配送
|
||||
const DELIVERY_STATUS_SELF = 2;//上门自提
|
||||
const DELIVERY_STATUS_CITY = 3;//同城配送
|
||||
|
||||
//订单状态
|
||||
public static function getOrderStatus($status = true)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_WAIT_PAY => '待付款',
|
||||
self::STATUS_WAIT_DELIVERY => '待发货',
|
||||
self::STATUS_WAIT_RECEIVE => '待收货',
|
||||
self::STATUS_FINISH => '已完成',
|
||||
self::STATUS_CLOSE => '已关闭',
|
||||
];
|
||||
if ($status === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$status] ?? '未知';
|
||||
}
|
||||
|
||||
|
||||
//订单类型
|
||||
public static function getOrderType($type)
|
||||
{
|
||||
$desc = [
|
||||
self::NORMAL_ORDER => '普通订单',
|
||||
self::SECKILL_ORDER => '秒杀订单',
|
||||
self::TEAM_ORDER => '拼团订单',
|
||||
self::BARGAIN_ORDER => '砍价订单',
|
||||
];
|
||||
|
||||
if ($type === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$type] ?? '未知';
|
||||
}
|
||||
|
||||
//配送方式
|
||||
public static function getDeliveryType($type)
|
||||
{
|
||||
$desc = [
|
||||
self::DELIVERY_STATUS_EXPRESS => '快递发货',
|
||||
self::DELIVERY_STATUS_SELF => '上门自提',
|
||||
self::DELIVERY_STATUS_CITY => '同城配送',
|
||||
];
|
||||
|
||||
if ($type === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$type] ?? '未知';
|
||||
}
|
||||
|
||||
|
||||
//下单时间
|
||||
public function getCreateTimeAttr($value, $data)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
|
||||
//付款时间
|
||||
public function getPayTimeAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
$value = '未支付';
|
||||
return $value;
|
||||
}
|
||||
|
||||
// 发货时间
|
||||
public function getShippingTimeAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
//收货时间
|
||||
public function getTakeTimeAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
//取消时间
|
||||
public function getCancelTimeAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
//订单类型
|
||||
public function getOrderTypeTextAttr($value, $data)
|
||||
{
|
||||
return self::getOrderType($data['order_type']);
|
||||
}
|
||||
|
||||
//订单状态
|
||||
public function getOrderStatusTextAttr($value, $data)
|
||||
{
|
||||
return self::getOrderStatus($data['order_status']);
|
||||
}
|
||||
|
||||
//订单支付方式
|
||||
public function getPayWayTextAttr($value, $data)
|
||||
{
|
||||
return Pay::getPayWay($data['pay_way']);
|
||||
}
|
||||
|
||||
//订单支付状态
|
||||
public function getPayStatusTextAttr($value, $data)
|
||||
{
|
||||
return Pay::getPayStatus($data['pay_status']);
|
||||
}
|
||||
|
||||
//订单来源
|
||||
public function getOrderSourceTextAttr($value, $data)
|
||||
{
|
||||
return Client_::getClient($data['order_source']);
|
||||
}
|
||||
|
||||
//订单商品数量
|
||||
public function getGoodsCountAttr($value, $data)
|
||||
{
|
||||
return count($this->order_goods);
|
||||
}
|
||||
|
||||
|
||||
//订单关联商品
|
||||
public function orderGoods()
|
||||
{
|
||||
return $this->hasMany('order_goods', 'order_id', 'id');
|
||||
}
|
||||
|
||||
//订单用户
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
|
||||
//收货地址
|
||||
public function getDeliveryAddressAttr($value, $data)
|
||||
{
|
||||
$region = Db::name('dev_region')
|
||||
->where('id', 'IN', [$data['province'], $data['city'], $data['district']])
|
||||
->order('level asc')
|
||||
->column('name');
|
||||
|
||||
$region_desc = implode('', $region);
|
||||
return $region_desc . $data['address'];
|
||||
}
|
||||
}
|
||||
47
application/common/model/OrderGoods.php
Normal file
47
application/common/model/OrderGoods.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\server\UrlServer;
|
||||
use think\Model;
|
||||
|
||||
class OrderGoods extends Model
|
||||
{
|
||||
|
||||
//订单商品退款状态
|
||||
const REFUND_STATUS_NO = 0;//未申请退款
|
||||
const REFUND_STATUS_APPLY = 1;//申请退款
|
||||
const REFUND_STATUS_WAIT = 2;//等待退款
|
||||
const REFUND_STATUS_SUCCESS = 3;//退款成功
|
||||
|
||||
public function getImageAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return UrlServer::getFileUrl($value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getBaseImageAttr($value, $data)
|
||||
{
|
||||
return $data['image'];
|
||||
}
|
||||
|
||||
}
|
||||
87
application/common/model/OrderLog.php
Normal file
87
application/common/model/OrderLog.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class OrderLog extends Model
|
||||
{
|
||||
//操作人类型
|
||||
const TYPE_USER = 0;//会员
|
||||
const TYPE_SHOP = 1;//门店
|
||||
const TYPE_SYSTEM = 2;//系统
|
||||
|
||||
//订单动作
|
||||
const USER_ADD_ORDER = 101;//提交订单
|
||||
const USER_CANCEL_ORDER = 102;//取消订单
|
||||
const USER_DEL_ORDER = 103;//删除订单
|
||||
const USER_CONFIRM_ORDER = 104;//确认收货
|
||||
const USER_PAID_ORDER = 105;//支付订单
|
||||
|
||||
const SHOP_CANCEL_ORDER = 201;//商家取消订单
|
||||
const SHOP_DEL_ORDER = 202;//商家删除订单
|
||||
const SHOP_DELIVERY_ORDER = 203;//商家发货
|
||||
const SHOP_CONFIRM_ORDER = 204;//商家确认收货
|
||||
|
||||
const SYSTEM_CANCEL_ORDER = 301;//系统取消订单
|
||||
const SYSTEM_CONFIRM_ORDER = 302;//系统确认订单
|
||||
|
||||
//订单动作明细
|
||||
public static function getLogDesc($log)
|
||||
{
|
||||
$desc = [
|
||||
self::USER_ADD_ORDER => '会员提交订单',
|
||||
self::USER_CANCEL_ORDER => '会员取消订单',
|
||||
self::USER_DEL_ORDER => '会员删除订单',
|
||||
self::USER_CONFIRM_ORDER => '会员确认收货',
|
||||
self::USER_PAID_ORDER => '会员支付订单',
|
||||
|
||||
self::SHOP_CANCEL_ORDER => '商家取消订单',
|
||||
self::SHOP_DEL_ORDER => '商家删除订单',
|
||||
self::SHOP_DELIVERY_ORDER => '商家发货',
|
||||
self::SHOP_CONFIRM_ORDER => '商家确认收货',
|
||||
|
||||
self::SYSTEM_CANCEL_ORDER => '系统取消订单',
|
||||
self::SYSTEM_CONFIRM_ORDER => '系统确认收货',
|
||||
];
|
||||
|
||||
if ($log === true) {
|
||||
return $desc;
|
||||
}
|
||||
|
||||
return isset($desc[$log]) ? $desc[$log] : $log;
|
||||
}
|
||||
|
||||
//订单日志
|
||||
public static function getOrderLog($order_id)
|
||||
{
|
||||
$logs = Db::name('order_log')
|
||||
->where('order_id', $order_id)
|
||||
->select();
|
||||
|
||||
foreach ($logs as &$log){
|
||||
$log['create_time'] = date('Y-m-d H:i:s', $log['create_time']);
|
||||
$log['channel'] = self::getLogDesc($log['channel']);
|
||||
}
|
||||
|
||||
return $logs;
|
||||
}
|
||||
}
|
||||
106
application/common/model/Pay.php
Normal file
106
application/common/model/Pay.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\server\UrlServer;
|
||||
use think\Model;
|
||||
|
||||
class Pay extends Model
|
||||
{
|
||||
|
||||
protected $name = 'dev_pay';
|
||||
|
||||
|
||||
const UNPAID = 0;//待支付
|
||||
const ISPAID = 1;//已支付
|
||||
const REFUNDED = 2;//已退款
|
||||
const REFUSED_REFUND = 3;//拒绝退款
|
||||
|
||||
//支付方式
|
||||
const WECHAT_PAY = 1;//微信支付
|
||||
const ALI_PAY = 2;//支付宝支付
|
||||
const BALANCE_PAY = 3;//余额支付
|
||||
const OFFLINE_PAY = 4;//线下支付
|
||||
|
||||
|
||||
//支付状态
|
||||
public static function getPayStatus($type)
|
||||
{
|
||||
$data = [
|
||||
self::UNPAID => '待支付',
|
||||
self::ISPAID => '已支付',
|
||||
self::REFUNDED => '已退款',
|
||||
self::REFUSED_REFUND => '拒绝退款',
|
||||
];
|
||||
|
||||
if ($type === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$type] ?? '未知';
|
||||
}
|
||||
|
||||
|
||||
//支付方式
|
||||
public static function getPayWay($type)
|
||||
{
|
||||
$data = [
|
||||
self::WECHAT_PAY => '微信支付',
|
||||
self::ALI_PAY => '支付宝支付',
|
||||
self::BALANCE_PAY => '余额支付',
|
||||
self::OFFLINE_PAY => '线下支付',
|
||||
];
|
||||
|
||||
if ($type === true) {
|
||||
return $data;
|
||||
}
|
||||
return $data[$type] ?? '其他';
|
||||
}
|
||||
|
||||
|
||||
|
||||
//图片路径
|
||||
public function getIconAttr($value, $data)
|
||||
{
|
||||
return UrlServer::getFileUrl($value);
|
||||
}
|
||||
|
||||
|
||||
//支付设置状态
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
if ($data['status'] == 1){
|
||||
return '启用';
|
||||
}
|
||||
return '关闭';
|
||||
}
|
||||
|
||||
|
||||
//各种支付的配置
|
||||
public function getConfigAttr($value, $data)
|
||||
{
|
||||
if ($value){
|
||||
return json_decode($value, true);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
26
application/common/model/Shop.php
Normal file
26
application/common/model/Shop.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class Shop extends Model
|
||||
{
|
||||
|
||||
}
|
||||
47
application/common/model/ShopAccountLog.php
Normal file
47
application/common/model/ShopAccountLog.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class ShopAccountLog extends Model{
|
||||
const ORDER_SETTLE = 100; //店铺结算
|
||||
const WITHDRAW_AUDIT = 200; //店铺提现
|
||||
const WITHDRAW_REFUSE = 201; //店铺提现拒绝
|
||||
|
||||
|
||||
public static function getSourceTypeDesc($from){
|
||||
$desc = [
|
||||
self::ORDER_SETTLE => '店铺结算',
|
||||
self::WITHDRAW_AUDIT => '店铺提现',
|
||||
self::WITHDRAW_REFUSE => '店铺提现拒绝',
|
||||
];
|
||||
if($from === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '账户变动';
|
||||
}
|
||||
|
||||
public static function getRemarkDesc($from,$source_sn,$remark){
|
||||
$desc = [
|
||||
self::ORDER_SETTLE => '结算单号:'.$source_sn,
|
||||
self::WITHDRAW_AUDIT => '提现单号:'.$source_sn,
|
||||
];
|
||||
return $desc[$from] ?? $remark;
|
||||
}
|
||||
}
|
||||
69
application/common/model/ShopWithdraw.php
Normal file
69
application/common/model/ShopWithdraw.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class ShopWithdraw extends Model{
|
||||
|
||||
const WAIT_AUDIT = 1;
|
||||
const WAIT_REMITTANCE = 2;
|
||||
const SUCCEED_REMITTANCE =3;
|
||||
const AUDIT_REFUSE = 4;
|
||||
|
||||
|
||||
public static function getStatus($from){
|
||||
$desc = [
|
||||
self::WAIT_AUDIT => '待审核',
|
||||
self::WAIT_REMITTANCE => '待转账',
|
||||
self::SUCCEED_REMITTANCE => '已转账',
|
||||
self::AUDIT_REFUSE => '审核拒绝',
|
||||
];
|
||||
if($from === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
public function getCreateTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
|
||||
public function getMoneyAttr($value,$data){
|
||||
return '¥'.$value;
|
||||
}
|
||||
|
||||
public function getStatusDescAttr($value,$data){
|
||||
return self::getStatus($data['status']);
|
||||
}
|
||||
//todo 提现方式
|
||||
public function getWithdrawWayAttr($value,$data){
|
||||
$name = '银行卡';
|
||||
if($value == 2){
|
||||
$name = '支付宝';
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
public function getRemittanceTimeAttr($value,$data){
|
||||
if($value){
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
24
application/common/model/SmsConfig.php
Normal file
24
application/common/model/SmsConfig.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class SmsConfig extends Model{
|
||||
|
||||
}
|
||||
56
application/common/model/SmsLog.php
Normal file
56
application/common/model/SmsLog.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class SmsLog extends Model{
|
||||
const send_ing = 0;
|
||||
const send_success = 1;
|
||||
const send_fail = 2;
|
||||
|
||||
public static function getSendStatusDesc($from){
|
||||
$desc = [
|
||||
self::send_ing => '发送中',
|
||||
self::send_success => '发送成功',
|
||||
self::send_fail => '发送失败',
|
||||
];
|
||||
if($from === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$from] ?? '';
|
||||
}
|
||||
|
||||
public static function getCreateTimeAttr($value,$data){
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
public static function getSendTimeAttr($value,$data){
|
||||
if($value){
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public static function getSendStatusAttr($value,$data){
|
||||
return self::getSendStatusDesc($value);
|
||||
}
|
||||
|
||||
public static function getResultsAttr($value,$data){
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
33
application/common/model/Team.php
Normal file
33
application/common/model/Team.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 拼团
|
||||
* Class Team
|
||||
* @package app\common\model
|
||||
*/
|
||||
class Team extends Model
|
||||
{
|
||||
const STATUS_WAIT_SUCCESS = 0;
|
||||
const STATUS_SUCCESS = 1;
|
||||
const STATUS_ERROR = 2;
|
||||
|
||||
//拼团状态
|
||||
public static function getStatusDesc($type)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_WAIT_SUCCESS => '拼团中',
|
||||
self::STATUS_SUCCESS => '拼团成功',
|
||||
self::STATUS_ERROR => '拼团失败',
|
||||
];
|
||||
|
||||
if ($type === true){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$type] ?? '';
|
||||
}
|
||||
}
|
||||
24
application/common/model/TeamActivity.php
Normal file
24
application/common/model/TeamActivity.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 拼团活动商品-模型
|
||||
* Class TeamActivity
|
||||
* @package app\common\model
|
||||
*/
|
||||
class TeamActivity extends Model
|
||||
{
|
||||
// protected $pk = 'team_id';
|
||||
/**
|
||||
* Notes: 关联拼团模型
|
||||
* @author 张无忌(2021/1/14 15:34)
|
||||
*/
|
||||
public function teamFound()
|
||||
{
|
||||
return $this->hasMany('TeamFound', 'team_id', 'team_id');
|
||||
}
|
||||
}
|
||||
39
application/common/model/TeamFollow.php
Normal file
39
application/common/model/TeamFollow.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 拼团参团
|
||||
* Class TeamFollow
|
||||
* @package app\common\model
|
||||
*/
|
||||
class TeamFollow extends Model
|
||||
{
|
||||
// 关联用户模型
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'follow_user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
}
|
||||
44
application/common/model/TeamFound.php
Normal file
44
application/common/model/TeamFound.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 拼团开团
|
||||
* Class TeamFound
|
||||
* @package app\common\model
|
||||
*/
|
||||
class TeamFound extends Model
|
||||
{
|
||||
// 关联用户模型
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne('user', 'id', 'user_id')
|
||||
->field('id,sn,nickname,avatar,level,mobile,sex,create_time');
|
||||
}
|
||||
|
||||
public function teamFollow()
|
||||
{
|
||||
return $this->hasMany('team_follow', 'found_id', 'id');
|
||||
}
|
||||
}
|
||||
16
application/common/model/TeamGoodsItem.php
Normal file
16
application/common/model/TeamGoodsItem.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 拼团商品规格模型
|
||||
* Class TeamGoodsItem
|
||||
* @package app\common\model
|
||||
*/
|
||||
class TeamGoodsItem extends Model
|
||||
{
|
||||
|
||||
}
|
||||
64
application/common/model/User.php
Normal file
64
application/common/model/User.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use app\common\server\UrlServer;
|
||||
use think\Model;
|
||||
|
||||
class User extends Model
|
||||
{
|
||||
//头像
|
||||
public function getAvatarAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return UrlServer::getFileUrl($value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function getBaseAvatarAttr($value, $data)
|
||||
{
|
||||
return $data['avatar'];
|
||||
}
|
||||
|
||||
//加入时间
|
||||
public function getCreateTimeAttr($value, $data)
|
||||
{
|
||||
return date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
|
||||
//性别转换
|
||||
public function getSexAttr($value, $data)
|
||||
{
|
||||
switch ($value) {
|
||||
case 1:
|
||||
return '男';
|
||||
case 2:
|
||||
return '女';
|
||||
default:
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
public function level()
|
||||
{
|
||||
return $this->hasOne('UserLevel','id', 'level');
|
||||
}
|
||||
}
|
||||
11
application/common/model/UserLevel.php
Normal file
11
application/common/model/UserLevel.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class UserLevel extends Model
|
||||
{
|
||||
|
||||
}
|
||||
83
application/common/model/UserTask.php
Normal file
83
application/common/model/UserTask.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class UserTask extends Model{
|
||||
//会员任务
|
||||
const USERTASK = [
|
||||
[
|
||||
'type' =>'SatisfactionIntegral',
|
||||
'name' =>'满足积分{$num}',
|
||||
'real_name' =>'积分数',
|
||||
'max_number' =>0,
|
||||
'min_number' =>0,
|
||||
'unit' =>'分'
|
||||
],
|
||||
[
|
||||
'type' =>'ConsumptionAmount',
|
||||
'name' =>'消费满{$num}',
|
||||
'real_name' =>'消费金额',
|
||||
'max_number' =>0,
|
||||
'min_number' =>0,
|
||||
'unit' =>'元'
|
||||
],
|
||||
[
|
||||
'type' =>'ConsumptionFrequency',
|
||||
'name' =>'消费{$num}',
|
||||
'real_name' =>'消费次数',
|
||||
'max_number' =>0,
|
||||
'min_number' =>0,
|
||||
'unit' =>'次'
|
||||
],
|
||||
[
|
||||
'type' =>'CumulativeAttendance',
|
||||
'name' =>'累计签到{$num}',
|
||||
'real_name' =>'累计签到',
|
||||
'max_number' =>365,
|
||||
'min_number' =>1,
|
||||
'unit' =>'天'
|
||||
],
|
||||
[
|
||||
'type' =>'SharingTimes',
|
||||
'name' =>'分享给朋友{$num}',
|
||||
'real_name' =>'分享给朋友',
|
||||
'max_number' =>1000,
|
||||
'min_number' =>1,
|
||||
'unit' =>'次'
|
||||
],
|
||||
[
|
||||
'type' =>'InviteGoodFriends',
|
||||
'name' =>'邀请好友{$num}成为下线',
|
||||
'real_name' =>'邀请好友成为下线',
|
||||
'max_number' =>1000,
|
||||
'min_number' =>1,
|
||||
'unit' =>'人'
|
||||
],
|
||||
[
|
||||
'type' =>'InviteGoodFriendsLevel',
|
||||
'name' =>'邀请好友{$num}成为会员',
|
||||
'real_name' =>'邀请好友成为会员',
|
||||
'max_number' =>1000,
|
||||
'min_number' =>1,
|
||||
'unit' =>'人'
|
||||
],
|
||||
];
|
||||
|
||||
}
|
||||
58
application/common/model/WeChat.php
Normal file
58
application/common/model/WeChat.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
use think\Model;
|
||||
|
||||
class WeChat extends Model{
|
||||
/**
|
||||
* 消息类型常量
|
||||
*/
|
||||
const msg_type_text = 'text'; //回复文本信息
|
||||
const msg_type_image = 'image'; //回复图片信息
|
||||
const msg_type_voice = 'voice'; //回复语音信息
|
||||
const msg_type_video = 'video'; //回复视频消息
|
||||
const msg_type_music = 'music'; //回复音乐消息
|
||||
const msg_type_news = 'news'; //回复图文消息
|
||||
const msg_type_location = 'location'; //回复地理位置消息
|
||||
const msg_type_link = 'link'; //回复链接信息
|
||||
const msg_type_event = 'event'; //回复事件
|
||||
const msg_type_default = 'default'; //默认回复
|
||||
|
||||
/**
|
||||
* 事件类型常量
|
||||
*/
|
||||
const msg_event_subscribe = 'subscribe'; //关注事件-首次关注
|
||||
const msg_event_unsubscribe = 'unsubscribe'; //取消关注事件
|
||||
const msg_event_scan = 'SCAN'; //关注事件-已关注
|
||||
const msg_event_location = 'LOCATION'; //上报地理位置事件
|
||||
const msg_event_click = 'CLICK'; //点击菜单拉取消息时的事件推送
|
||||
const msg_event_view = 'VIEW'; //点击菜单跳转链接时的事件
|
||||
|
||||
public static function getCustomReply($form = true){
|
||||
$desc = [
|
||||
self::msg_event_subscribe => '关注回复',
|
||||
self::msg_type_text => '关键词回复',
|
||||
self::msg_type_default => '默认回复',
|
||||
];
|
||||
if( true === $form){
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$form] ??[];
|
||||
}
|
||||
}
|
||||
71
application/common/model/Withdraw.php
Normal file
71
application/common/model/Withdraw.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Withdraw extends Model
|
||||
{
|
||||
|
||||
//提现类型
|
||||
const TYPE_BALANCE = 1; // 提现到钱包余额
|
||||
const TYPE_WECHAT_CHANGE = 2; // 提现到微信零钱
|
||||
const TYPE_WECHAT_CODE = 3; // 提现到微信收款码
|
||||
const TYPE_ALI_CODE = 4; // 提现到支付宝收款码
|
||||
const TYPE_BANK = 5; // 提现到银行卡
|
||||
|
||||
|
||||
//提现状态
|
||||
const STATUS_WAIT = 1; // 待提现
|
||||
const STATUS_ING = 2; // 提现中
|
||||
const STATUS_SUCCESS = 3; // 提现成功
|
||||
const STATUS_FAIL = 4; //提现失败
|
||||
|
||||
//提现状态
|
||||
public static function getStatusDesc($status = true)
|
||||
{
|
||||
$desc = [
|
||||
self::STATUS_WAIT => '待提现',
|
||||
self::STATUS_ING => '提现中',
|
||||
self::STATUS_SUCCESS => '提现成功',
|
||||
self::STATUS_FAIL => '提现失败'
|
||||
];
|
||||
if ($status === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$status] ?? '';
|
||||
}
|
||||
|
||||
//提现类型
|
||||
public static function getTypeDesc($status = true)
|
||||
{
|
||||
$desc = [
|
||||
self::TYPE_BALANCE => '钱包余额',
|
||||
self::TYPE_WECHAT_CHANGE => '微信零钱',
|
||||
self::TYPE_BANK => '银行卡',
|
||||
self::TYPE_WECHAT_CODE => '微信收款码',
|
||||
self::TYPE_ALI_CODE => '支付宝收款码',
|
||||
];
|
||||
if ($status === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$status] ?? '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user