first commit

This commit is contained in:
云泽网
2025-07-27 21:42:34 +08:00
commit c1cce5ccb4
2779 changed files with 340042 additions and 0 deletions
@@ -0,0 +1,326 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\LoginLogic;
use app\api\validate\WechatLoginValidate;
use app\common\server\ConfigServer;
class Account extends ApiBase
{
public $like_not_need_login = ['register','applogin', 'login', 'mnplogin', 'codeurl', 'oalogin', 'oplogin','logout','smslogin', 'uinAppLogin', 'silentLogin', 'authLogin'];
/**
* note 注册接口
* create_time 2020/10/23 18:42
*/
public function register(){
$post = $this->request->post();
$post['check_code'] = ConfigServer::get('register_setting', 'open', 0);
$result = $this->validate($post,'app\api\validate\Register');
if($result ===true){
$data = LoginLogic::register($post);
if($data){
$this->_success('注册成功',$data);
}
$this->_error('获取失败',$result,0);
}$this->_error($result,'',0);
}
/**
* showdoc
* @catalog 接口/账号
* @title 手机号账号登录
* @description 手机号账号登录
* @method post
* @url /account/login
* @return {"code":1,"msg":"登录成功","data":["token":"3237676fa733d73333341",//登录令牌"nickname":"好象cms-小林",//昵称"avatar":"http://b2c.yixiangonline.com/uploads/user/avatar/3f102df244d5b40f21c4b25dc321c5ab.jpeg",//头像url"level":0,//等级],"show":0,"time":"0.775400"}
* @param account 必填 string 账号或手机号
* @param id 必填 int 1-密码登录-2-验证码登录
* @param password 必填 string 密码
* @param client 必填 int 客户端类型:2-h53-ios4-android
* @return_param token string 登录令牌
* @return_param nickname string 昵称
* @return_param avatar string 头像
* @remark
* @number 1
*/
public function login()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Login.password');
if (true !== $check) {
$this->_error($check);
}
$data = LoginLogic::login($post);
$this->_success('登录成功', $data);
}
/**
* 验证码登录
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function smsLogin(){
$post = $this->request->post();
$post['message_key'] = 'YZMDL';
$check = $this->validate($post, 'app\api\validate\Login.code');
if (true !== $check) {
$this->_error($check);
}
$data = LoginLogic::login($post);
$this->_success('登录成功', $data);
}
/**
* showdoc
* @catalog 接口/账号
* @title 小程序登录
* @description 小程序登录
* @method post
* @url /account/mnpLogin
* @return {"code":1,"msg":"登录成功","data":["token":"3237676fa733d73333341",//登录令牌"nickname":"好象cms-小林",//昵称"avatar":"http://b2c.yixiangonline.com/uploads/user/avatar/3f102df244d5b40f21c4b25dc321c5ab.jpeg",//头像url"level":0,//等级],"show":0,"time":"0.775400"}
* @param code 必填 string code
* @param iv 必填 string iv
* @param encrypted_data 必填 string encrypted_data
* @return_param token string 登录令牌
* @return_param nickname string 昵称
* @return_param avatar string 头像
* @remark
* @number 1
*/
public function mnpLogin()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\MnpLogin');
if (true !== $check) {
$this->_error($check);
}
$data = LoginLogic::mnpLogin($post);
$this->_success($data['msg'], $data['data'], $data['code'], $data['show']);
}
/**
* showdoc
* @catalog 接口/账号
* @title 获取获取向微信请求code的链接
* @description
* @method get
* @url /account/codeurl
* @param url 必填 varchar 前端当前url
* @return_param url string codeurl
* @remark 这里是备注信息
* @number 0
* @return {"code":1,"msg":"获取成功","data":{"url":'http://mp.weixin……'}}
*/
public function codeUrl()
{
$url = $this->request->get('url');
$this->_success('获取成功', ['url' => LoginLogic::codeUrl($url)], 1);
}
/**
* showdoc
* @catalog 接口/账号
* @title 微信H5登录
* @description 微信H5登录
* @method post
* @url /account/oalogin
* @return {"code":1,"msg":"登录成功","data":["token":"3237676fa733d73333341",//登录令牌"nickname":"好象cms-小林",//昵称"avatar":"http://b2c.yixiangonline.com/uploads/user/avatar/3f102df244d5b40f21c4b25dc321c5ab.jpeg",//头像url"level":0,//等级],"show":0,"time":"0.775400"}
* @param code 必填 string code
* @return_param token string 登录令牌
* @return_param nickname string 昵称
* @return_param avatar string 头像
* @remark
* @number 1
*/
public function oaLogin()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\OaLogin');
if (true !== $check) {
$this->_error($check);
}
$data = LoginLogic::oaLogin($post);
$this->_success($data['msg'], $data['data'], $data['code'], $data['show']);
}
/**
* showdoc
* @catalog 接口/账号
* @title 微信第三方app登录
* @description 微信第三方app登录
* @method post
* @url /account/oplogin
* @return {"code":1,"msg":"登录成功","data":["token":"3237676fa733d73333341",//登录令牌"nickname":"好象cms-小林",//昵称"avatar":"http://b2c.yixiangonline.com/uploads/user/avatar/3f102df244d5b40f21c4b25dc321c5ab.jpeg",//头像url"level":0,//等级],"show":0,"time":"0.775400"}
* @param code 必填 string code
* @param client 必填 int 客户端类型:3-ios4-android
* @return_param token string 登录令牌
* @return_param nickname string 昵称
* @return_param avatar string 头像
* @remark
* @number 1
*/
public function opLogin()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\OpLogin');
if (true !== $check) {
$this->_error($check);
}
$data = LoginLogic::opLogin($post);
$this->_success($data['msg'], $data['data'], $data['code']);
}
/**
* 退出登录
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function logout()
{
LoginLogic::logout($this->user_id, $this->client);
//退出登录只有成功
$this->_success();
}
/**
* Notes: uniapp微信登录
* @author 段誉(2021/3/16 16:00)
*/
public function uinAppLogin()
{
$post = $this->request->post();
$data = LoginLogic::uinAppLogin($post);
$this->_success($data['msg'], $data['data'], $data['code']);
}
//2021-0419 小程序新版登录调整
/**
* Notes: 小程序登录(旧系统用户,返回用户信息,否则返回空)
* @author 段誉(2021/4/19 16:50)
*/
public function silentLogin()
{
$post = $this->request->post();
if (empty($post['code'])) {
$this->_error('参数缺失');
}
$data = LoginLogic::silentLogin($post);
$this->_success($data['msg'], $data['data'], $data['code'], $data['show']);
}
/**
* Notes: 小程序登录(新用户登录->需要提交昵称和头像参数)
* @author 段誉(2021/4/19 16:49)
*/
public function authLogin()
{
$post = $this->request->post();
if (empty($post['code']) || empty($post['nickname'])) {
$this->_error('参数缺失');
}
$data = LoginLogic::authLogin($post);
$this->_success($data['msg'], $data['data'], $data['code'], $data['show']);
}
/**
* @notes 更新用户头像昵称
* @throws \think\Exception
* @throws \think\exception\PDOException
* @author ljj
* @date 2023/2/1 3:46 下午
*/
public function updateUser()
{
$post = $this->request->post();
if (!isset($post['avatar']) || empty($post['avatar'])) {
$this->_error('参数缺失');
}
if (!isset($post['nickname']) || empty($post['nickname'])) {
$this->_error('参数缺失');
}
$data = LoginLogic::updateUser($post,$this->user_id);
$this->_success($data['msg'], $data['data'], $data['code'], $data['show']);
}
/**
* @notes 小程序绑定微信
* @return void
* @author lbzy
* @datetime 2023-11-29 09:43:24
*/
public function mnpAuthLogin()
{
$params = $this->request->post();
if (empty($params['code'])) {
$this->_error('参数缺失');
}
$params['user_id'] = $this->user_id;
$result = (new LoginLogic())->mnpAuthLogin($params);
if ($result === false) {
$this->_error(LoginLogic::getError());
}
$this->_success('绑定成功');
}
/**
* @notes 公众号绑定微信
* @return void
* @author lbzy
* @datetime 2023-11-29 09:43:16
*/
public function oaAuthLogin()
{
$params = $this->request->post();
if (empty($params['code'])) {
$this->_error('参数缺失');
}
$params['user_id'] = $this->user_id;
$result = (new LoginLogic())->oaAuthLogin($params);
if ($result === false) {
$this->_error(LoginLogic::getError());
}
$this->_success('绑定成功');
}
}
@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\ActivityAreaLogic;
class ActivityArea extends ApiBase
{
public $like_not_need_login = ['activityGoodsList'];
public function activityGoodsList()
{
$id = $this->request->get('id');
$list = ActivityAreaLogic::activityGoodsList($id, $this->page_no, $this->page_size);
$this->_success('获取成功', $list);
}
}
+59
View File
@@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\AdLogic;
class Ad extends ApiBase
{
public $like_not_need_login = ['lists'];
/**
* showdoc
* @catalog 接口/广告
* @title 获取广告列表
* @description 获取广告列表
* @method get
* @url ad/lists
* @param pid 必填 int 广告位id
* @param client 必填 int 终端,1-移动端商城;2-PC端商城
* @return_param image string 广告图片
* @return_param link_type int 广告类型:1-商场页面;2-商品页面;3-自定义类型
* @return_param link string 广告链接
* @return_param params string 参数
* @return_param is_tab int 是否tab页:1-是;0-否
* @remark
* @number 0
* @return {"code":1,"msg":"获取成功","data":{"lists":["http:\/\/www.likeb2b2c.com:20002\/uploads\/images\/20200706\/e4bdb.jpg","http:\/\/www.likeb2b2c.com:20002\/uploads\/images\/20200708\/893ae.jpg"]},"show":0,"time":"0.686155","debug":{"request":{"get":{"pid":"1"},"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"f804bef0-b397-4590-a67f-b489830cd37b","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.1","token":"ff0c66fe0c89fe1e9be591d82d551521","content-type":"","content-length":""}}}}
*/
public function lists()
{
$pid = $this->request->get('pid');
$client = $this->request->get('client', 1);
if ($pid) {
$list = AdLogic::lists($pid, $client);
} else {
$list = [];
}
$this->_success('获取成功', $list);
}
}
@@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\AdLogic;
class AdContent extends ApiBase
{
public $like_not_need_login = ['lists'];
/**
* showdoc
* @catalog 接口/广告
* @title 获取广告列表
* @description 获取广告列表
* @method get
* @url ad/lists
* @param pid 必填 int 广告位id
* @param client 必填 int 终端,1-移动端商城;2-PC端商城
* @return_param image string 广告图片
* @return_param link_type int 广告类型:1-商场页面;2-商品页面;3-自定义类型
* @return_param link string 广告链接
* @return_param params string 参数
* @return_param is_tab int 是否tab页:1-是;0-否
* @remark
* @number 0
* @return {"code":1,"msg":"获取成功","data":{"lists":["http:\/\/www.likeb2b2c.com:20002\/uploads\/images\/20200706\/e4bdb.jpg","http:\/\/www.likeb2b2c.com:20002\/uploads\/images\/20200708\/893ae.jpg"]},"show":0,"time":"0.686155","debug":{"request":{"get":{"pid":"1"},"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"f804bef0-b397-4590-a67f-b489830cd37b","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.1","token":"ff0c66fe0c89fe1e9be591d82d551521","content-type":"","content-length":""}}}}
*/
public function lists()
{
$pid = $this->request->get('pid');
$client = $this->request->get('client', 1);
if ($pid) {
$list = AdLogic::lists($pid, $client);
} else {
$list = [];
}
$this->_success('获取成功', $list);
}
}
@@ -0,0 +1,104 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\AfterSaleLogic;
/**
* 售后
* Class Order
* @package app\api\controller
*/
class AfterSale extends ApiBase
{
public function lists()
{
$type = $this->request->get('type', 'normal');
$lists = AfterSaleLogic::lists($this->user_id, $type, $this->page_no, $this->page_size);
$this->_success('',$lists);
}
public function add()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$check = $this->validate($post, 'app\api\validate\AfterSale.add');
if (true !== $check) {
$this->_error($check);
}
return AfterSaleLogic::add($post, $this->user_id);
}
//售后商品信息
public function goodsInfo()
{
$get = $this->request->get();
$check = $this->validate($get, 'app\api\validate\AfterSale.info');
if (true !== $check) {
$this->_error($check);
}
$this->_success('', AfterSaleLogic::info($get['item_id'], $get['order_id']));
}
public function express()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\AfterSale.express');
if (true !== $check) {
$this->_error($check);
}
return AfterSaleLogic::express($this->user_id, $post);
}
public function cancel()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\AfterSale.cancel');
if (true !== $check) {
$this->_error($check);
}
AfterSaleLogic::cancel($this->user_id, $post);
$this->_success('撤销成功');
}
public function detail()
{
$get = $this->request->get();
$this->_success('', AfterSaleLogic::detail($get));
}
public function again()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\AfterSale.again');
if (true !== $check) {
$this->_error($check);
}
return AfterSaleLogic::again($this->user_id, $post);
}
}
@@ -0,0 +1,153 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use think\App;
use think\Controller;
use think\exception\HttpResponseException;
use think\facade\Config;
use think\facade\Debug;
use think\Response;
class ApiBase extends Controller
{
public $user_info = [];
public $user_id = null;
public $client = null;
public $page_no = 1;
public $page_size = 15;
public $like_not_need_login = [];
/**
* 底层控制器初始化
* ApiBase constructor.
* @param App|null $app
*/
public function __construct(App $app = null)
{
parent::__construct($app);
self::setValue();
}
/**
* User: 意象信息科技 lr
* Desc: 设置基础控制器属性值
*/
private function setValue()
{
//用户信息
$this->user_info = $this->request->user_info ?? [];
$this->user_id = $this->request->user_info['id'] ?? null;
$this->client = $this->request->user_info['client'] ?? null;
//分页参数
$page_no = (int)$this->request->get('page_no');
$this->page_no = $page_no && is_numeric($page_no) ? $page_no : $this->page_no;
$page_size = (int)$this->request->get('page_size');
$this->page_size = $page_size && is_numeric($page_size) ? $page_size : $this->page_size;
$this->page_size = min($this->page_size, 100);
}
/**
* User: 意象信息科技 lr
* Desc: 请求成功
* @param string $msg
* @param array $data
* @param int $code
* @param int $show
* @param array $header
*/
protected function _success($msg = '', $data = [], $code = 1, $show = 0, array $header = [])
{
$type = $this->getResponseType();
$time = Debug::getUseTime();
$result = [
'code' => $code,
'msg' => $msg,
'data' => $data,
'show' => $show,
'time' => $time,
];
if (Config::get('app_trace')) {
$result['debug'] = [
'request' => [
'get' => $this->request->get(),
'post' => $this->request->post(),
'header' => $this->request->header(),
]
];
}
$type = $this->getResponseType();
// 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_success_tmpl')]);
throw new HttpResponseException($response);
}
/**
* User: 意象信息科技 lr
* Desc: 请求失败
* @param string $msg
* @param array $data
* @param int $code
* @param int $show
* @param array $header
*/
protected function _error($msg = '', $data = [], $code = 0, $show = 1, array $header = [])
{
$type = $this->getResponseType();
$time = Debug::getUseTime();
$result = [
'code' => $code,
'msg' => $msg,
'data' => $data,
'show' => $show,
'time' => $time,
];
if (Config::get('app_trace')) {
$result['debug'] = [
'request' => [
'get' => $this->request->get(),
'post' => $this->request->post(),
'header' => $this->request->header(),
]
];
}
if ('html' == strtolower($type)) {
$type = 'jump';
}
$response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_error_tmpl')]);
throw new HttpResponseException($response);
}
}
@@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\ArticleLogic;
class Article extends ApiBase
{
public $like_not_need_login = ['lists', 'category', 'detail'];
public function lists()
{
$id = $this->request->get('id');
$article = ArticleLogic::lists($id, $this->page_no, $this->page_size);
$this->_success('获取成功', $article);
}
public function category()
{
$article = ArticleLogic::CategoryLists();
$this->_success('获取成功', $article);
}
public function detail()
{
$id = $this->request->get('id');
$client = $this->request->get('client',1);
if (!$id) {
$this->_error('参数缺失');
}
$article_detail = ArticleLogic::getArticleDetail($id,$client);
$this->_success('获取成功', $article_detail);
}
}
@@ -0,0 +1,133 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\BargainLogic;
class Bargain extends ApiBase{
public $like_not_need_login = ['barginNumber', 'lists','detail','closeBargain'];
/**
* Notes:获取砍价成功人数
* @author: 2021/2/23 16:11
*/
public function barginNumber(){
$number = BargainLogic::barginNumber();
$this->_success('获取成功',$number);
}
/**
* Notes: 砍价列表
* @author: 2021/2/23 15:54
*/
public function lists(){
$list = BargainLogic::lists($this->page_no, $this->page_size);
$this->_success('获取成功',$list);
}
/**
* Notes:砍价活动详情
* @author: 2021/2/23 17:44
*/
public function detail(){
$bargain_id = $this->request->get('bargain_id');
$result = $this->validate(['bargain_id'=>$bargain_id],'app\api\validate\Bargain.detail');
if(true === $result){
$detail = BargainLogic::detail($bargain_id);
$this->_success('获取成功',$detail);
}
$this->_error($result);
}
/**
* Notes:发起砍价
* @author: 2021/2/23 18:43
*/
public function sponsor(){
$post_data = $this->request->post();
$result = $this->validate($post_data,'app\api\validate\Bargain.sponsor');
if(true === $result){
$data = BargainLogic::sponsor($post_data,$this->user_id);
$this->_success($data['msg'],$data['data'],$data['code'],$data['show']);
}
$this->_error($result);
}
/**
* Notes:砍价助力
* @author: 2021/2/25 18:21
*/
public function knife(){
$id = $this->request->post('id');
$result = $this->validate(['id'=>$id,'user_id'=>$this->user_id],'app\api\validate\Bargain.knife');
if(true === $result){
$data = BargainLogic::knife($id,$this->user_id);
$this->_success($data['msg'],$data['data'],$data['code'],$data['show']);
}
$this->_error($result);
}
/**
* Notes:砍价订单列表
* @author: 2021/2/24 17:15
*/
public function orderList(){
$type = $this->request->get('type','-1');
$list = BargainLogic::orderList($type,$this->user_id,$this->page_no,$this->page_size);
$this->_success('获取成功',$list);
}
/**
* Notes:砍价详情
* @author: 2021/2/24 15:36
*/
public function bargainDetail(){
$id = $this->request->get('id');
$result = $this->validate(['id'=>$id,'user_id'=>$this->user_id],'app\api\validate\Bargain.bargainDetail');
if(true === $result){
$detail = BargainLogic::bargainDetail($id,$this->user_id);
$this->_success('获取成功',$detail);
}
$this->_error($result);
}
/**
* Notes:关闭砍价订单
* @author: 2021/2/26 16:36
*/
public function closeBargain(){
$id = $this->request->post('id');
if($id){
BargainLogic::closeBargain($id);
}
$this->_success('');
}
}
@@ -0,0 +1,98 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\CartLogic;
/**
* 购物车
* Class Cart
* @package app\api\controller
*/
class Cart extends ApiBase
{
public function lists()
{
$this->_success('', CartLogic::lists($this->user_id));
}
public function add()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.add');
if (true !== $check) {
$this->_error($check);
}
$res = CartLogic::add($post['item_id'], $post['goods_num'], $this->user_id);
if ($res === true) {
$this->_success('加入成功');
}
$this->_error($res);
}
public function change()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.change');
if ($check !== true) {
$this->_error($check);
}
$res = CartLogic::change($post['cart_id'], $post['goods_num']);
if ($res === true) {
$this->_success();
}
$this->_error($res);
}
public function del()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.del');
if (true !== $check) {
$this->_error($check);
}
if (CartLogic::del($post['cart_id'], $this->user_id)) {
$this->_success('删除成功');
}
$this->_error('删除失败');
}
public function selected()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\Cart.selected');
if (true !== $check) {
$this->_error($check);
}
CartLogic::selected($post, $this->user_id);
$this->_success();
}
public function num()
{
$this->_success('',CartLogic::cartNum($this->user_id));
}
}
@@ -0,0 +1,40 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\CollectLogic;
class Collect extends ApiBase{
/**
* note 商品收藏列表
* create_time 2020/10/29 10:17
*/
public function getCollectGoods(){
$collect = CollectLogic::getCollectGoods($this->user_id,$this->page_no,$this->page_size);
$this->_success('获取成功',$collect);
}
/**
* note 商品收藏操作
* create_time 2020/10/29 10:17
*/
public function handleCollectGoods(){
$post = $this->request->post();
$collect = CollectLogic::handleCollectGoods($post,$this->user_id);
$this->_success('获取成功',$collect);
}
}
@@ -0,0 +1,89 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\CouponLogic;
class Coupon extends ApiBase{
public $like_not_need_login = ['couponlist','getgoodscoupon'];
/**
* note 领券中心
* create_time 2020/10/22 12:06
*/
public function couponList(){
$coupon_list = CouponLogic::getCouponList($this->user_id);
$this->_success('获取成功',$coupon_list);
}
/**
* note 商品详情获取优惠券
* create_time 2020/10/22 18:14
*/
public function getGoodsCoupon(){
$id = $this->request->get('id');
$coupon_list = [];
if($id){
$coupon_list = CouponLogic::getGoodsCoupon($this->user_id,$id);
}
$this->_success('',$coupon_list);
}
/**
* note 领取优惠券
* create_time 2020/10/22 12:06
*/
public function getCoupon(){
$coupon_id = $this->request->post('id');
$result = $this->validate(['id'=>$coupon_id,'user_id'=>$this->user_id],'app\api\validate\GetCoupon');
if($result === true){
$result = CouponLogic::userGetCoupon($coupon_id,$this->user_id);
if($result == true){
$this->_success('领取成功','');
}
$result = '领取失败';
}
$this->_error($result);
}
/**
* note 我的优惠券
* create_time 2020/10/26 9:37
*/
public function myCoupon(){
$type = $this->request->get('type',1);
$coupon_list = CouponLogic::getMyCouponList($this->user_id,$type);
$this->_success('获取成功',$coupon_list);
}
/**
* note 下单获取优惠券
* create_time 2020/10/28 11:06
*/
public function orderCoupon(){
$goods = $this->request->post('goods');
$data = CouponLogic::orderCoupon($goods,$this->user_id);
$this->_success('获取成功',$data);
}
/**
* note 注册赠送优惠券
* create_time 2020/12/4 10:29
*/
public function registerSendCoupon(){
$list = CouponLogic::registerSendCoupon($this->user_id);
$this->_success('获取成功',$list);
}
}
@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
class Dispatch extends ApiBase
{
public $like_not_need_login = ['_error'];
public function dispatch_error($msg = '', $code = 0)
{
return $this->_error($msg, [], $code);
}
}
@@ -0,0 +1,176 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\DistributionLogic;
use app\common\model\User;
class Distribution extends ApiBase
{
public $like_not_need_login = ['fixAncestorRelation'];
/**
* 填写邀请码
*/
public function code()
{
$code = $this->request->post('code');
$data = [
'user_id' => $this->user_id,
'code' => $code,
];
$result = $this->validate($data, 'app\api\validate\DistributionCode');
if ($result !== true) {
$this->_error($result, [], 0, 0);
}
$result = DistributionLogic::code($code, $this->user_id);
if ($result !== true) {
$this->_error($result, [], 0, 0);
}
$this->_success();
}
/**
* 分销会员申请
*/
public function apple()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$result = $this->validate($post, 'app\api\validate\DistributionApply');
if ($result !== true) {
$this->_error($result);
}
$result = DistributionLogic::apple($post,$this->user_id);
if ($result !== true) {
$this->_error($result);
}
$this->_success();
}
/**
* 最新的分销会员申请详情
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function appleDetail()
{
$this->_success('',DistributionLogic::appleDetail($this->user_id));
}
/**
* User: 意象信息科技 mjf
* Desc: 我的分销上级
*/
public function myLeader()
{
$this->_success('', DistributionLogic::myLeader($this->user_id));
}
/**
* 分销推广主页信息
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$this->_success('', DistributionLogic::index($this->user_id));
}
/**
* 分销订单
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function order()
{
$get = $this->request->get();
$this->_success('', DistributionLogic::order($this->user_id, $get, $this->page_no, $this->page_size));
}
/**
* 月度账单
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function monthBill()
{
$this->_success('', DistributionLogic::getMonthBill($this->user_id, $this->page_no, $this->page_size));
}
/**
* 月度账单明细
*/
public function monthDetail()
{
$get = $this->request->get();
$this->_success('', DistributionLogic::getMonth($get, $this->user_id, $this->page_no, $this->page_size));
}
/**
* Notes: 分销会员页面判断
* @author 段誉(2021/2/1 18:45)
*/
public function check()
{
$distribution = \app\common\model\Distribution::where('user_id', $this->user_id)->findOrEmpty()->toArray();
if (!empty($distribution) && $distribution['is_distribution'] == 1) {
$this->_success('', '', 10001);//已是分销会员
} else {
$this->_success('', '',20001);//未是分销会员
}
}
/**
* 修复旧的关系链
*/
public function fixAncestorRelation()
{
$result = DistributionLogic::fixAncestorRelation();
if ($result['flag']) {
$this->_success($result['msg']);
}
$this->_error($result['msg']);
}
/**
* @notes 获取背景海报
* @return Json
* @author cjhao
* @date 2021/11/29 11:35
*/
public function getPoster()
{
$result = DistributionLogic::getPoster();
$this->_success('',$result);
}
}
@@ -0,0 +1,47 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\common\server\FileServer;
class File extends ApiBase
{
public $like_not_need_login = ['formImage','test'];
/**
* showdoc
* @catalog 接口/上传文件
* @title form表单方式上传图片
* @description 图片上传
* @method post
* @url /file/formimage
* @return param name string 图片名称
* @return param url string 文件地址
* @remark
* @number 1
* @return {"code":1,"msg":"上传文件成功","data":{"url":"http:\/\/likeb2b2c.yixiangonline.com\/uploads\/images\/user\/20200810\/3cb866f6bb30b7239d91582f7d9822d6.png","name":"2.png"},"show":0,"time":"0.283254","debug":{"request":{"get":[],"post":[],"header":{"content-length":"103132","content-type":"multipart\/form-data; boundary=--------------------------206668736604428806173438","connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"1f8aa4dd-f53c-4d12-98b4-8d901ac847db","cache-control":"no-cache","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.2"}}}}
*/
public function formImage()
{
$data = FileServer::userFormImage($this->user_id);
$this->_success($data['msg'], $data['data'], $data['code']);
}
}
@@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\FootPrintLogic;
class Footprint extends ApiBase
{
public $like_not_need_login = ['lists'];
public function lists()
{
$lists = FootPrintLogic::lists();
$this->_success('获取成功', $lists);
}
}
@@ -0,0 +1,90 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\GoodsLogic;
class Goods extends ApiBase{
public $like_not_need_login = ['getgoodsdetail', 'getgoodslist','getbestlist','gethostlist','getsearchpage'];
/**
* note 商品列表
* create_time 2020/10/20 11:12
*/
public function getGoodsList(){
$get = $this->request->get();
$goods_list = GoodsLogic::getGoodsList($this->user_id, $get, $this->page_no, $this->page_size);
$this->_success('获取成功',$goods_list);
}
/**
* note 商品详情
* create_time 2020/10/20 11:12
*/
public function getGoodsDetail(){
$id = $this->request->get('id');
$goods = GoodsLogic::getGoodsDetail($this->user_id,$id);
if($goods){
$this->_success('获取成功',$goods);
}
$this->_error('商品不存在',[],0,0);
}
/**
* note 首页好物优选
* create_time 2020/10/21 19:04
*/
public function getBestList() {
$goods_list = GoodsLogic::getBestList($this->page_no, $this->page_size);
$this->_success('获取成功', $goods_list);
}
/**
* note 热销商品
* create_time 2020/11/17 9:52
*/
public function getHostList(){
$goods_list = GoodsLogic::getHostList($this->page_no, $this->page_size);
$this->_success('获取成功', $goods_list);
}
/**
* note 获取搜索页数据
* create_time 2020/10/22 16:01
*/
public function getSearchPage(){
$limit = $this->request->get('limit ',10);
$list = GoodsLogic::getSearchPage($this->user_id,$limit);
$this->_success('',$list);
}
/**
* note 清空搜索记录
* create_time 2020/12/18 10:26
*/
public function clearSearch(){
$result = GoodsLogic::clearSearch($this->user_id);
if($result){
$this->_success('清理成功','');
}
$this->_error('清理失败','');
}
}
@@ -0,0 +1,36 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\GoodsCategoryLogic;
class GoodsCategory extends ApiBase{
public $like_not_need_login = ['lists'];
/**
* Notes:获取商品分类
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @author: 2021/3/6 18:49
*/
public function lists(){
$client = $this->request->get('client',1);
$cateogry = GoodsCategoryLogic::categoryThirdTree($client);
$this->_success('获取成功',$cateogry);
}
}
@@ -0,0 +1,84 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\GoodsCommentLogic;
class GoodsComment extends ApiBase{
public $like_not_need_login = ['lists','category'];
/**
* note 商品评论分类
* create_time 2020/11/11 16:33
*/
public function category()
{
$get = $this->request->get();
$collect = GoodsCommentLogic::category($get);
$this->_success('获取成功', $collect);
}
/**
* note 商品评论列表
* create_time 2020/11/11 16:34
*/
public function lists(){
$get = $this->request->get();
$collect = GoodsCommentLogic::lists($get, $this->page_no, $this->page_size);
$this->_success('获取成功', $collect);
}
/**
* note 添加商品评论
* create_time 2020/11/11 15:14
*/
public function addGoodsComment()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$result = $this->validate($post, 'app\api\validate\GoodsComment');
if ($result === true) {
$result = GoodsCommentLogic::addGoodsComment( $post,$this->user_id);
if($result === true){
$this->_success('评论成功');
}
}
$this->_error($result);
}
/**
* note 获取未评论或已评论的订单商品列表
* create_time 2020/11/12 11:11
*/
public function getOrderGoods(){
$type = $this->request->get('type',1);
$list = GoodsCommentLogic::getOrderGoods($type,$this->user_id, $this->page_no, $this->page_size);
$this->_success('',$list);
}
/**
* note 获取评论的商品信息
* create_time 2020/11/13 14:45
*/
public function getGoods(){
$id = $this->request->get('id');
if($id){
$goods = GoodsCommentLogic::getGoods($id);
$this->_success('获取成功',$goods);
}
$this->_success('请选择评论的商品');
}
}
@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\HelpLogic;
class Help extends ApiBase
{
public $like_not_need_login = ['lists', 'category', 'detail'];
public function lists()
{
$id = $this->request->get('id');
$article = HelpLogic::lists($id, $this->page_no, $this->page_size);
$this->_success('获取成功', $article);
}
public function category()
{
$help = HelpLogic::CategoryLists();
$this->_success('获取成功', $help);
}
public function detail()
{
$id = $this->request->get('id');
$client = $this->request->get('client',1);
$help_detail = HelpLogic::getHelpDetail($id,$client);
$this->_success('获取成功', $help_detail);
}
}
+185
View File
@@ -0,0 +1,185 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\IndexLogic;
use app\common\model\Client_;
use app\common\model\MessageScene_;
use app\common\server\ConfigServer;
use app\common\server\UrlServer;
use think\facade\Hook;
use think\Db;
class Index extends ApiBase
{
public $like_not_need_login = ['test', 'lists', 'appInit', 'downLine', 'share', 'config','pcLists','copyright'];
/**
* note 首页接口
* create_time 2020/10/21 19:05
*/
public function lists(){
$lists = IndexLogic::lists($this->user_id);
return $this->_success('',$lists);
}
/**
* app下载链接 todo lr未完成
*/
public function downLine()
{
$get = $this->request->get();
$check = $this->validate($get, 'app\api\validate\App');
if (true !== $check) {
$this->_error($check);
}
if(isset($get['client']) && $get['client'] == Client_::ios){
$this->_success('', ['line' => ConfigServer::get('app', 'line_ios', '')]);
}else{
$this->_success('', ['line' => ConfigServer::get('app', 'line_android', '')]);
}
}
/**
* app初始化接口
* 苹果不允许单独只有微信第三方登录
*/
public function appInit()
{
$data = [
'wechat_login' => ConfigServer::get('app', 'wechat_login', '',0),//微信登录
//弹出协议
'agreement' => ConfigServer::get('app', 'agreement', '',1)
];
$this->_success('', $data);
}
/**
* Notes: 获取分享信息
* @author 张无忌(2021/1/20 17:04)
* @return array|mixed|string
*/
public function share()
{
$client = $this->request->get('client', Client_::mnp, 'intval');
$config = [];
switch ($client) {
case Client_::mnp:
$config = ConfigServer::get('share', 'mnp', [
'mnp_share_title' => '',
'mnp_share_image' => ''
]);
if (!empty($config['mnp_share_image']) and $config['mnp_share_image'] !== '') {
$config['mnp_share_image'] = UrlServer::getFileUrl($config['mnp_share_image']);
}
break;
case Client_::oa:
$config = ConfigServer::get('share', 'h5', [
'h5_share_title' => '',
'h5_share_intro' => '',
'h5_share_image' => ''
]);
if (!empty($config['h5_share_image']) and $config['h5_share_image'] !== '') {
$config['h5_share_image'] = UrlServer::getFileUrl($config['h5_share_image']);
}
break;
case Client_::android:
case Client_::ios:
$config = ConfigServer::get('share', 'app', [
'app_share_title' => '',
'app_share_intro' => '',
'app_share_image' => ''
]);
if (!empty($config['app_share_image']) and $config['app_share_image'] !== '') {
$config['app_share_image'] = UrlServer::getFileUrl($config['app_share_image']);
}
break;
}
return $this->_success('获取成功', $config);
}
/**
* Notes: 设置
* @author 段誉(2021/2/25 15:39)
*/
public function config()
{
$navigation = Db::name('dev_navigation')
->field('name,selected_icon,un_selected_icon')
->where('del', 0)
->order('id', 'desc')
->select();
foreach($navigation as &$item) {
$item['selected_icon'] = empty($item['selected_icon']) ? '' : UrlServer::getFileUrl($item['selected_icon']);
$item['un_selected_icon'] = empty($item['un_selected_icon']) ? '' : UrlServer::getFileUrl($item['un_selected_icon']);
}
$config = [
'register_setting' => ConfigServer::get('register_setting', 'open', 0),//注册设置-是否开启短信验证注册
'app_wechat_login' => ConfigServer::get('app', 'wechat_login', 0),//APP是否允许微信授权登录
'shop_login_logo' => UrlServer::getFileUrl(ConfigServer::get('website', 'shop_login_logo')),//移动端登录页logo
'web_favicon' => UrlServer::getFileUrl(ConfigServer::get('website', 'web_favicon')),//浏览器标签图标
'name' => ConfigServer::get('website', 'name'),//商城名称
'copyright_info' => ConfigServer::get('copyright', 'company_name'),//版权信息
'icp_number' => ConfigServer::get('copyright', 'number'),//ICP备案号
'icp_link' => ConfigServer::get('copyright', 'link'),//备案号链接
'app_agreement' => ConfigServer::get('app', 'agreement', 0),//app弹出协议
'ios_download' => ConfigServer::get('app', 'line_ios', ''),//ios_app下载链接
'android_download' => ConfigServer::get('app', 'line_android', ''),//安卓下载链接
'download_doc' => ConfigServer::get('app', 'download_doc', ''),//app下载文案
'cate_style' => ConfigServer::get('decoration', 'layout_no', 1),//分类页面风格
'index_setting' => [ // 首页设置
// 热销榜单
'logo' => ConfigServer::get('decoration', 'index_setting_logo', 1),
// 热销榜单
'hots' => ConfigServer::get('decoration', 'index_setting_hots', 1),
// 新品推荐
'news' => ConfigServer::get('decoration', 'index_setting_news', 1),
// 顶部背景图
'top_bg_image' => UrlServer::getFileUrl(ConfigServer::get('decoration', 'index_setting_top_bg_image', ''))
],
'center_setting' => [ // 个人中心设置
// 顶部背景图
'top_bg_image' => UrlServer::getFileUrl(ConfigServer::get('decoration', 'center_setting_top_bg_image', ''))
],
'navigation_setting' => [ // 底部导航设置
// 未选中文字颜色
'ust_color' => ConfigServer::get('decoration', 'navigation_setting_ust_color', '#000000'),
// 选中文字颜色
'st_color' => ConfigServer::get('decoration', 'navigation_setting_st_color', '#000000'),
// 顶部背景图
// 'top_bg_image' => UrlServer::getFileUrl(ConfigServer::get('decoration', 'navigation_setting_top_bg_image', ''))
],
// 首页底部导航菜单
'navigation_menu' => $navigation,
// 网站名称
'website_name' => ConfigServer::get('website', 'name')
];
$this->_success('', $config);
}
/**
* @notes 版权资质
* @author ljj
* @date 2022/2/22 3:09 下午
*/
public function copyright()
{
$result = IndexLogic::copyright();
$this->_success('', $result);
}
}
@@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\LiveRoomLogic;
/**
* 直播 控制器层
* Class LiveRoom
* @package app\api\controller
*/
class LiveRoom extends ApiBase
{
public $like_not_need_login = ['lists'];
/**
* @notes 获取直播信息列表
* @author heshihu
* @date 2021/10/14 10:08
*/
public function lists()
{
$live_room = LiveRoomLogic::lists($this->page_no, $this->page_size);
if(is_string($live_room)){
$this->_error($live_room);
}
$this->_success('获取成功', $live_room);
}
}
@@ -0,0 +1,103 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\LoginPasswordLogic;
class LoginPassword extends ApiBase
{
public $like_not_need_login = ['check', 'checkcode', 'forget'];
/**
* showdoc
* @catalog 接口/登录注册
* @title 密码登录
* @description 密码登录
* @method post
* @url /login_password/check
* @param mobile 必填 int 手机号
* @param password 必填 varchar 密码
* @param client 选填 int 不填默认1小程序-2h5-3ios-4安卓
* @return_param token varchar token
* @remark
* @number 1
* @return {"code":1,"msg":"登录成功","data":{"token":"d2800867ac869c52a7a017b89209907d"},"show":0,"time":"0.125048","debug":{"request":{"get":[],"post":{"mobile":"13711515723","password":"123456czw"},"header":{"content-length":"288","content-type":"multipart\/form-data; boundary=--------------------------249270077524121393881040","connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"883b6917-66c2-4995-a882-fbc5625bad33","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.2","token":"ff0c66fe0c89fe1e9be591d82d551521"}}}}
*/
public function check()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\LoginPassword.add');
if ($result === true) {
$check = LoginPasswordLogic::check($post);
if ($check) {
$this->_error($check['msg'], $check['data'], $check['code']);
}
$this->_error('获取失败', $result, 0);
}
$this->_error($result, '', 0);
}
/**
* showdoc
* @catalog 接口/登录注册
* @title 验证码登录
* @description 验证码登录
* @method post
* @url /login_password/checkCode
* @param mobile 必填 int 手机号
* @param code 必填 varchar 验证码
* @param client 选填 int 不填默认1小程序-2h5-3ios-4安卓
* @return_param token varchar token
* @remark
* @number 1
* @return {"code":1,"msg":"登录成功","data":{"token":"c108d186a4e62bc3ac6004074930d43b"},"show":0,"time":"0.136925","debug":{"request":{"get":[],"post":{"mobile":"13711515723","code":"8888"},"header":{"content-length":"279","content-type":"multipart\/form-data; boundary=--------------------------405368968101365594543781","connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"cd4c0d70-e3b5-4576-9f8d-58bbdb6f0e5f","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.2","token":"ff0c66fe0c89fe1e9be591d82d551521"}}}}
*/
public function checkCode()
{
$post = $this->request->post();
$post['message_key'] = 'YZMDL';
$result = $this->validate($post, 'app\api\validate\LoginPassword.code');
if ($result === true) {
$check = LoginPasswordLogic::checkCode($post);
if ($check) {
$this->_error($check['msg'], $check['data'], $check['code']);
}
$this->_error('获取失败', $result, 0);
}
$this->_error($result, '', 0);
}
//忘记密码
public function forget()
{
$post = $this->request->post();
$post['message_key'] = 'ZHMM';
$result = $this->validate($post, 'app\api\validate\LoginPassword.forget');
if ($result === true) {
return LoginPasswordLogic::forget($post);
}
$this->_error($result);
}
}
@@ -0,0 +1,60 @@
<?php
namespace app\api\controller;
use app\api\logic\LuckdrawLogic;
class Luckdraw extends ApiBase
{
/**
* Notes: 抽奖奖品
* @author 张无忌(2021/1/26 16:07)
*/
public function prize()
{
$lists = LuckdrawLogic::getPrize($this->user_id);
$this->_success('OK', $lists);
}
/**
* Notes: 用户抽奖记录
* @author 张无忌(2021/1/26 16:14)
*/
public function record()
{
$lists = LuckdrawLogic::getUserRecord($this->user_id, $this->page_no, $this->page_size);
$this->_success('OK', $lists);
}
/**
* Notes: 抽奖 start
* @author 张无忌(2021/1/26 17:00)
*/
public function draw()
{
$check = $this->validate(['user_id' => $this->user_id],'app\api\validate\Luckdraw');
if (true !== $check) {
$this->_error($check);
}
$result = LuckdrawLogic::draw($this->user_id);
if ($result) {
$this->_success('OK', $result);
}
$error = LuckdrawLogic::getError() ?: '抽奖失败';
$this->_error($error);
}
/**
* @notes 中奖列表
* @author 段誉
* @date 2022/2/17 15:41
*/
public function winList()
{
$result = LuckdrawLogic::getWinList($this->page_no, $this->page_size);
$this->_success('OK', $result);
}
}
@@ -0,0 +1,33 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\MenuLogic;
class Menu extends ApiBase
{
public $like_not_need_login = ['lists'];
public function lists()
{
$type = $this->request->get('type', 1);
$list = MenuLogic::getMenu($type,$this->user_info);
return $this->_success('获取成功', $list);
}
}
@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\common\logic\NoticeLogic;
class Notice extends ApiBase
{
//消息中心
public function index()
{
$this->_success('获取成功', NoticeLogic::index($this->user_id));
}
//列表
public function lists()
{
$type = $this->request->get('type');
$page = $this->request->get('page_no', $this->page_no);
$size = $this->request->get('page_size', $this->page_size);
$this->_success('获取成功', NoticeLogic::lists($this->user_id, $type, $page, $size));
}
}
+221
View File
@@ -0,0 +1,221 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\OrderLogic;
use app\common\model\Client_;
use app\common\server\ConfigServer;
use app\common\server\WechatMiniExpressSendSyncServer;
use think\Db;
/**
* 订单
* Class Order
* @package app\api\controller
*/
class Order extends ApiBase
{
//订单列表
public function lists()
{
$type = $this->request->get('type', 'all');
$order_list = OrderLogic::getOrderList($this->user_id, $type, $this->page_no, $this->page_size);
$this->_success('获取成功', $order_list);
}
//下单接口
public function buy()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$post['client'] = $this->client;
$check = $this->validate($post, 'app\api\validate\Order.buy');
if (true !== $check) {
$this->_error($check);
}
$action = $post['action'];
$info = OrderLogic::info($post, $this->user_id);
if ($info['code'] == 0) {
$this->_error($info['msg']);
}
if ($action == 'info') {
$this->_success('', $info['data']);
}
$order = OrderLogic::add($this->user_id, $info['data'], $post);
return $order;
}
//订单详情
public function detail()
{
$order_id = $this->request->get('id');
if (!$order_id){
$this->_error('请选择订单');
}
$order_detail = OrderLogic::getOrderDetail($order_id, $this->user_id);
if (!$order_detail) {
$this->_error('订单不存在了!', '');
}
$this->_success('获取成功', $order_detail);
}
/**
* @notes 微信确认收货 获取详情
* @return \think\response\Json
* @author lbzy
* @datetime 2023-09-05 09:51:41
*/
function wxReceiveDetail()
{
return $this->_success('获取成功', OrderLogic::wxReceiveDetail(input('order_id/d'), $this->user_id));
}
//取消订单
public function cancel()
{
$order_id = $this->request->post('id');
if (empty($order_id)) {
$this->_error('参数错误');
}
return OrderLogic::cancel($order_id, $this->user_id);
}
//删除订单
public function del()
{
$order_id = $this->request->post('id');
if (empty($order_id)) {
$this->_error('参数错误');
}
return OrderLogic::del($order_id, $this->user_id);
}
//确认订单
public function confirm()
{
$order_id = $this->request->post('id');
if (empty($order_id)) {
$this->_error('参数错误');
}
return OrderLogic::confirm($order_id, $this->user_id);
}
public function orderTraces()
{
$order_id = $this->request->get('id');
$tips = '参数错误';
if ($order_id) {
$traces = OrderLogic::orderTraces($order_id, $this->user_id);
if ($traces) {
$this->_success('获取成功', $traces);
}
$tips = '暂无物流信息';
}
$this->_error($tips);
}
/**
* @notes 核销订单列表
* @author ljj
* @date 2021/8/18 3:58 下午
*/
public function verificationLists()
{
$type = $this->request->get('type',\app\common\model\Order::NOT_WRITTEN_OFF);
$lists = OrderLogic::verificationLists($type, $this->user_id, $this->page_no, $this->page_size);
$this->_success('获取成功', $lists);
}
/**
* @notes 提货核销
* @author ljj
* @date 2021/8/18 4:36 下午
*/
public function verification()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$check = $this->validate($post, 'app\api\validate\Order.verification');
if (true !== $check) {
$this->_error($check);
}
$result = OrderLogic::verification($post);
$this->_success('获取成功',$result);
}
/**
* @notes 确认提货
* @author ljj
* @date 2021/8/18 7:02 下午
*/
public function verificationConfirm()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$result = OrderLogic::verificationConfirm($post);
if (true !== $result) {
$this->_error($result);
}
$this->_success('提货成功');
}
/**
* @notes 获取配送方式
* @author ljj
* @date 2021/8/19 7:17 下午
*/
public function getDeliveryType()
{
$data = OrderLogic::getDeliveryType();
$this->_success('获取成功',$data);
}
/**
* @notes 微信同步发货 查询
* @return \think\response\Json
* @author lbzy
* @datetime 2023-09-07 15:27:17
*/
function wechatSyncCheck()
{
$id = $this->request->get('id');
$order = \app\common\model\Order::where('id', $id)->where('user_id', $this->user_id)->findOrEmpty();
$result = WechatMiniExpressSendSyncServer::wechatSyncCheck($order);
if (! $result) {
$this->_error('获取失败');
}
$this->_success('成功', $result);
}
}
@@ -0,0 +1,256 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\model\Order;
use app\common\model\Order as CommonOrder;
use app\common\model\Client_;
use app\common\server\AliPayServer;
use app\common\server\ConfigServer;
use app\common\server\WeChatPayServer;
use app\common\server\WeChatServer;
use app\common\logic\PaymentLogic;
use app\common\model\Pay;
use think\Db;
/**
* 支付逻辑
* Class Payment
* @package app\api\controller
*/
class Payment extends ApiBase
{
public $like_not_need_login = ['aliNotify', 'notifyMnp', 'notifyOa', 'notifyApp'];
/**
* Notes: 预支付
* @author 段誉(2021/2/23 14:33)
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function prepay()
{
$post = $this->request->post();
if(!isset($post['from']) || !isset($post['order_id']) || !isset($post['pay_way'])) {
$this->_error('参数缺失');
}
switch ($post['from']) {
case 'order':
$order = Order::get($post['order_id']);
if ($order['order_status'] == CommonOrder::STATUS_CLOSE || $order['del'] == 1) {
$this->_error('订单已关闭');
}
break;
case 'recharge':
$order = Db::name('recharge_order')->where(['id' => $post['order_id']])->find();
break;
}
//找不到订单
if (empty($order)) {
$this->_error('订单不存在');
}
// 变更支付方式
$order['pay_way'] = $post['pay_way'];
//已支付
if ($order['pay_status'] == Pay::ISPAID) {
$this->_success('支付成功', ['order_id' => $order['id']], 10000);
}
$result = PaymentLogic::pay($post['from'], $order, $this->client);
if (false === $result) {
$this->_error(PaymentLogic::getError(), ['order_id' => $order['id']], PaymentLogic::getReturnCode());
}
if (PaymentLogic::getReturnCode() != 0) {
$this->_success('', $result, PaymentLogic::getReturnCode());
}
$this->_success('', $result);
}
/**
* Notes: pc端预支付 NATIVE
* @author 段誉(2021/3/18 16:03)
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function pcPrepay()
{
$post = $this->request->post();
$order = Order::get($post['order_id']);
$order['pay_way'] = $post['pay_way'];
$return_msg = ['order_id' => $order['id'], 'order_amount' => $order['order_amount']];
//找不到订单
if (empty($order)) {
$this->_error('订单不存在');
}
if ($order['order_status'] == CommonOrder::STATUS_CLOSE || $order['del'] == 1) {
$this->_error('订单已关闭');
}
//已支付
if ($order['pay_status'] == Pay::ISPAID) {
$this->_success('支付成功', $return_msg, 10001);
}
$result = PaymentLogic::pcPay($order, $post['order_source']);
if (false === $result) {
$this->_error(PaymentLogic::getError(), $return_msg, PaymentLogic::getReturnCode());
}
if ($order['pay_way'] == Pay::BALANCE_PAY) {
$this->_success('支付成功', $return_msg, PaymentLogic::getReturnCode());
}
$return_msg['data'] = $result;
if (PaymentLogic::getReturnCode() != 0) {
$this->_success('支付成功', $return_msg, PaymentLogic::getReturnCode());
}
$this->_success('支付成功', $return_msg);
}
/**
* Notes: 小程序回调
* @author 段誉(2021/2/23 14:34)
*/
public function notifyMnp()
{
$config = WeChatServer::getPayConfig(Client_::mnp);
return WeChatPayServer::notify($config);
}
/**
* Notes: 公众号回调
* @author 段誉(2021/2/23 14:34)
*/
public function notifyOa()
{
$config = WeChatServer::getPayConfig(Client_::oa);
return WeChatPayServer::notify($config);
}
/**
* Notes: APP回调
* @author 段誉(2021/2/23 14:34)
*/
public function notifyApp()
{
$config = WeChatServer::getPayConfig(Client_::ios);
return WeChatPayServer::notify($config);
}
/**
* Notes: 支付宝回调
* @author 段誉(2021/3/23 11:37)
*/
public function aliNotify()
{
$data = $this->request->post();
$result = (new AliPayServer())->verifyNotify($data);
if (true === $result) {
echo 'success';
} else {
echo 'fail';
}
}
/**
* Notes:
* @author 段誉(2021/3/23 11:36)
* @return \think\Model[]
*/
public function payway()
{
$params = $this->request->get();
if(!isset($params['from']) || !isset($params['order_id'])) {
return $this->_error('参数缺失');
}
if($params['from'] == 'order') {
$order = Db::name('order')->where('id', $params['order_id'])->find();
}else if($params['from'] == 'recharge') {
$order = Db::name('recharge_order')->where('id', $params['order_id'])->find();
}
$payModel = new Pay();
$pay = $payModel->where(['status' => 1])->order('sort')->hidden(['config'])->select()->toArray();
foreach ($pay as $k => &$item) {
if ($item['code'] == 'wechat') {
$item['extra'] = '微信快捷支付';
$item['pay_way'] = Pay::WECHAT_PAY;
}
if ($item['code'] == 'balance') {
$user_money = Db::name('user')->where(['id' => $this->user_id])->value('user_money');
$item['extra'] = '可用余额:'.$user_money;
$item['pay_way'] = Pay::BALANCE_PAY;
}
if ($item['code'] == 'alipay') {
$item['extra'] = '';
$item['pay_way'] = Pay::ALI_PAY;
}
if (in_array($this->client, [Client_::mnp, Client_::oa]) && $item['code'] == 'alipay') {
unset($pay[$k]);
}
if($params['from'] == 'recharge' && $item['code'] == 'balance') {
unset($pay[$k]);
}
}
// 订单自动取消时间
$cancelTime = ConfigServer::get('trading', 'order_cancel');
if(empty($cancelTime)) {
// 前端检测为0时不显示倒计时
$cancelTime = 0;
}else{
// 订单创建时间 + 后台设置自动关闭未付款订单时长
$cancelTime = $order['create_time'] + intval($cancelTime) * 60;
}
$data = [
'pay' => array_values($pay),
'order_amount' => $order['order_amount'],
'cancel_time' => $cancelTime,
];
$this->_success('', $data);
}
}
+70
View File
@@ -0,0 +1,70 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\PcLogic;
class Pc extends ApiBase{
public $like_not_need_login = ['index','commonData','goodsList'];
/**
* Notes: pc端首页接口
* @author: 2021/3/5 12:00
*/
public function index(){
$lists = PcLogic::pcLists();
return $this->_success('',$lists);
}
/**
* Notes:pc广告公告数据
* @author: 2021/3/5 18:00
*/
public function commonData(){
return $this->_success('',PcLogic::commonData($this->user_id));
}
/**
* Notes:获取商品列表
* @author: 2021/3/5 17:19
*/
public function goodsList(){
$type = $this->request->get('type',1);
$sort_type = $this->request->get('sort_type','');
$sort = $this->request->get('sort','');
$name = $this->request->get('name','');
$category_id = $this->request->get('category_id','');
$list = PcLogic::goodsList($this->page_no,$this->page_size,$name,$category_id,$type,$sort_type,$sort);
return $this->_success('',$list);
}
/**
* Notes:修改用户信息
* @author: 2021/3/8 19:07
*/
public function changeUserInfo(){
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$result = $this->validate($post,'app\api\validate\ChangeUserInfo.pc');
if(true === $result){
PcLogic::changeUserInfo($post);
return $this->_success('保存成功');
}
return $this->_error($result);
}
}
@@ -0,0 +1,53 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\PolicyLogic;
class Policy extends ApiBase
{
public $like_not_need_login = ['service', 'privacy', 'aftersale'];
/**
* 服务协议
*/
public function service()
{
$this->_success('获取成功', PolicyLogic::service());
}
/**
* 隐私政策
*/
public function privacy()
{
$this->_success('获取成功', PolicyLogic::privacy());
}
/**
* 售后保障
*/
public function afterSale()
{
$this->_success('获取成功', PolicyLogic::afterSale());
}
}
@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\RechargeLogic;
class Recharge extends ApiBase{
public $like_not_need_login = ['rechargetemplate'];
/**
* note 充值模板
* create_time 2020/10/24 15:56
*/
public function rechargeTemplate(){
$list = RechargeLogic::getTemplate();
$this->_success('',$list);
}
/**
* note 充值
* create_time 2020/10/24 15:56
*/
public function recharge(){
$post = $this->request->post();
$result = $this->validate($post,'app\api\validate\Recharge');
if($result === true){
$data = RechargeLogic::recharge($this->user_id,$this->client,$post);
if($data){
$this->_success('',$data);
}
$this->_error('信息获取错误');
}
$this->_error($result);
}
/**
* 充值记录
*/
public function rechargeRecord()
{
$get = $this->request->get();
$get['page_no'] = $get['page_no'] ?? $this->page_no;
$get['page_size'] = $get['page_size'] ?? $this->page_size;
$get['user_id'] = $this->user_id;
$result = RechargeLogic::rechargeRecord($get);
return $this->_success('',$result);
}
}
@@ -0,0 +1,35 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\RegionLogic;
class Region extends ApiBase
{
public $like_not_need_login = ['lists'];
public function lists()
{
$lists = RegionLogic::lists();
$this->_success('获取成功', $lists);
}
}
@@ -0,0 +1,79 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\SeckillLogic;
class Seckill extends ApiBase{
public $like_not_need_login = ['seckilltime','seckillgoods'];
/**
* showdoc
* @catalog 接口/营销
* @title 获取秒杀时间段
* @description 获取秒杀时间段
* @method get
* @url /seckill/seckillTime
* @return {"code":1,"msg":"获取成功","data":[{"id":"1","start_time":"08:00","end_time":"10:00","is_open":0,"tips":"已结束"},{"id":"2","start_time":"11:00","end_time":"14:00","is_open":1,"tips":"抢购中"},{"id":"3","start_time":"14:00","end_time":"18:00","is_open":0,"tips":"未开始"},{"id":"4","start_time":"20:00","end_time":"22:00","is_open":0,"tips":"未开始"}],"show":0,"time":"0.274701","debug":{"request":{"get":[],"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"bd852ce3-cbe9-4c66-bb91-7e34eb223716","cache-control":"no-cache","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.1","content-type":"","content-length":""}}}}
* @return_param id int 活动id
* @return_param start_time varchar 开始时间
* @return_param end_time varchar 结束时间
* @return_param status int 状态0-未开始,1-抢购中;2-已结束
* @return_param tips string 提示
* @remark
* @number 1
*/
public function seckillTime(){
$list = SeckillLogic::seckillTime();
$this->_success('获取成功',$list);
}
/**
* showdoc
* @catalog 接口/营销
* @title 获取秒杀商品
* @description 获取秒杀商品
* @method get
* @url /seckill/seckillGoods
* @return {"code":1,"msg":"获取成功","data":{"list":[{"name":"华为儿童手表3 pro智能电话中小学生天才男女孩防水可爱运动多功能视频拍照通话gps定位4g电信版官方旗舰店","id":"2","image":"http:\/\/www.likeb2b2c.com:20002\/uploads\/images\/20200709\/161c78cbefc68afbbb0e1856b1a9a596.png","min_price":"789.00","seckill_price":"720.00","sales_sum":"0"},{"name":"雀巢(Nestle)脆脆鲨 休闲零食 威化饼干巧克力味24*20g+8*20g","id":"7","image":"http:\/\/www.likeb2b2c.com:20002\/uploads\/images\/20200710\/cd7dfb551061f353ba53d21c2a2275c4.jpg","min_price":"42.99","seckill_price":"40.00","sales_sum":"0"}],"page":1,"size":15,"count":2,"more":0},"show":0,"time":"0.449604","debug":{"request":{"get":{"id":"2"},"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"91999655-047e-4144-8de2-bedf1e3fac90","cache-control":"no-cache","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.1","content-type":"","content-length":""}}}}
* @param id 必填 int 活动id
* @param page_no 选填 int 页码(默认第一页)
* @param page_size 选填 int 每页数量(默认15)
* @return_param name string 商品名称
* @return_param id int 商品id
* @return_param image array 商品图片
* @return_param min_price float 商品最小价
* @return_param sales_sum int 销量
* @return_param seckill_price float 商品秒杀价
* @return_param shop_id int 店铺id
* @remark
* @number 1
*/
public function seckillGoods(){
$id = $this->request->get('id');
if($id){
$list = SeckillLogic::seckillGoods($id,$this->page_no,$this->page_size);
$this->_success('获取成功',$list);
}
$this->_error('缺少参数');
}
}
@@ -0,0 +1,50 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\SelffetchShopLogic;
class SelffetchShop extends ApiBase
{
/**
* @notes 查看自提门店列表
* @author ljj
* @date 2021/8/24 4:59 下午
*/
public function lists()
{
$params['longitude'] = $this->request->get('longitude', '113.280637');
$params['latitude'] = $this->request->get('latitude', '23.125178');
$lists = SelffetchShopLogic::lists($params, $this->page_no, $this->page_size);
$this->_success('获取成功', $lists);
}
/**
* @notes 获取百度地图密钥
* @author ljj
* @date 2021/8/24 5:01 下午
*/
public function getMapKey()
{
$result = SelffetchShopLogic::getMapKey();
$this->_success('获取成功', $result);
}
}
@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\ServiceLogic;
class Service extends ApiBase {
public $like_not_need_login = ['lists'];
public function lists(){
$list = ServiceLogic::getConfig();
$this->_success('获取成功',$list);
}
}
@@ -0,0 +1,90 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\ShareLogic;
use app\common\model\BargainLaunch;
class Share extends ApiBase
{
public function shareGoods()
{
$id = $this->request->get('id');
$url = $this->request->get('url');
$client = $this->client;
if ($id && $url) {
$result = ShareLogic::shareGoods($this->user_id, $id, $url, $client);
$this->_success($result['msg'], $result['data'], $result['code']);
}
$this->_error('缺少参数', '');
}
/**
* Notes: 用户分销海报
* @return array
* @author 段誉(2021/3/18 10:28)
*/
public function userPoster()
{
$url = $this->request->get('url');
$client = $this->client;
if (empty($client)) {
$this->_error('参数缺失');
}
$result = ShareLogic::getUserPoster($this->user_id, $url, $client);
return $result;
}
/**
* Notes:砍价分享
* @author: 2021/2/25 11:22
*/
public function shareBargain()
{
$id = $this->request->get('id');
$url = $this->request->get('url');
$result = $this->validate(['id' => $id, 'url' => $url], 'app\api\validate\Bargain.share');
if (true === $result) {
$result = ShareLogic::shareBargain($this->user_id, $id, $url, $this->client);
$this->_success($result['msg'], $result['data'], $result['code']);
}
$this->_error($result);
}
/**
* @notes 获取二维码
* @author cjhao
* @date 2021/11/25 10:47
*/
public function getMnQrcode()
{
$get = $this->request->get();
$result = $this->validate($get,'app\api\validate\MakeMnQrcode');
if(true === $result){
$result = ShareLogic::getMnQrcode($this->user_id,$get);
if(1 === $result['code']){
$this->_success('',$result['data']);
}
$this->_error($result['msg']);
}
$this->_error($result);
}
}
@@ -0,0 +1,92 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\SignLogic;
use app\common\server\ConfigServer;
class sign extends ApiBase{
/**
* showdoc
* @catalog 接口/签到
* @title 获取签到列表
* @description 获取签到列表
* @method get
* @url /sign/lists
* @return {"code":1,"msg":"获取成功","data":{"lists":[{"days":"1","sign_time":null,"status":"0","integral":"22","growth":"552"},{"days":"2","sign_time":null,"status":"0","integral":"22","growth":"552"},{"days":"3","sign_time":null,"status":"0","integral":63,"growth":563},{"days":"4","sign_time":null,"status":"0","integral":66,"growth":596},{"days":"5","sign_time":null,"status":"0","integral":"22","growth":"552"},{"days":"6","sign_time":null,"status":"0","integral":66,"growth":574}],"message":{"user_integral":"5041","days":"0"}},"show":0,"time":"0.126686","debug":{"request":{"get":[],"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"75a16271-edbd-4172-a238-a7d36ed07019","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.2","token":"ff0c66fe0c89fe1e9be591d82d551521","content-type":"","content-length":""}}}}
* @return_param days int 天数列表
* @return_param sign_time int 签到时间
* @return_param status int 签到状态
* @return_param integral int 积分值
* @return_param growth int 成长值
* @return_param user_integral int 用户积分
* @return_param user_growth int 用户成长值
* @remark
* @number 1
*/
public function lists(){
$sign = SignLogic::lists($this->user_id);
$this->_success('获取成功',$sign);
}
/**
* showdoc
* @catalog 接口/签到
* @title 签到
* @description 签到
* @method get
* @url /sign/sign
* @return {"code":1,"msg":"获取成功","data":{"integral":"22","growth":"552","day":1},"show":0,"time":"0.201775","debug":{"request":{"get":[],"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"1c4ef02d-b268-4ba7-a5df-c5b6a5f3d630","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.2","token":"ff0c66fe0c89fe1e9be591d82d551521","content-type":"","content-length":""}}}}
* @return_param integral int 获得积分值
* @return_param growth int 获得成长值
* @return_param days int 连续天数
* @remark
* @number 1
*/
public function sign(){
$result = $this->validate(['user_id'=>$this->user_id],'app\api\validate\Sign');
if($result === true){
$result = SignLogic::sign($this->user_id);
if(is_array($result)){
$this->_success('签到成功',$result);
}
}
$this->_error($result);
}
/**
* showdoc
* @catalog 接口/签到
* @title 获取签到规则
* @description 获取签到规则
* @method get
* @url /sign/rule
* @return {"code":1,"msg":"获取成功","data":"1.每天签到可以获得每天签到奖励;\n2.每日最多可签到1次,断签则会重新计算连签天数,达到连续天数后即可获得连续奖励;\n3.活动以及奖励最终解释权归商家所有。\n","show":0,"time":"0.173280","debug":{"request":{"get":[],"post":[],"header":{"connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"e8617112-b05d-4bea-a8d8-424a674f1c84","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.2","token":"ff0c66fe0c89fe1e9be591d82d551521","content-type":"","content-length":""}}}}
* @return_param * text 规则
* @remark
* @number 1
*/
public function rule(){
$rule = ConfigServer::get('sign_rule','instructions','');
$this->_success('获取成功',$rule);
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\SmsLogic;
class Sms extends ApiBase{
public $like_not_need_login = ['send'];
/**
* showdoc
* @catalog 接口/短信
* @title 发送短信
* @description 发送短信
* @method post
* @url /sms/send
* @return {"code":1,"msg":"发送成功","data":[],"show":0,"time":"0.612711","debug":{"request":{"get":[],"post":{"mobile":"13172565144","key":"ZCYZ"},"header":{"content-length":"278","content-type":"multipart\/form-data; boundary=--------------------------990456238154467810004652","connection":"keep-alive","accept-encoding":"gzip, deflate, br","host":"www.likeb2b2c.com:20002","postman-token":"d517ed7f-5a49-46e2-b975-8828e0475501","cache-control":"no-cache","accept":"*\/*","user-agent":"PostmanRuntime\/7.26.3"}}}}
* @return_param id int 订单id
* @param mobile 必填 int 手机号码
* @param key 必填 int 事件:ZCYZ-注册验证;ZHMM-找回密码;YZMDL-验证码登录; BGSJHM-更换手机号;BDSJHM-绑定手机号码
* @remark 这里是备注信息
* @number 0
*/
public function send(){
$mobile = $this->request->post('mobile');
$key = $this->request->post('key','ZCYZ');
$result = $this->validate(['mobile'=>$mobile,'key'=>$key],'app\api\validate\SmsSend');
if($result !== true){
$this->_error($result);
}
$send_result = SmsLogic::send($mobile,$key, $this->user_id);
if($send_result !== true){
$this->_error($send_result);
}
$this->_success('发送成功');
}
}
@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\SubscribeLogic;
class Subscribe extends ApiBase
{
public $like_not_need_login = ['lists'];
public function lists()
{
$scene = $this->request->get('scene');
if (!$scene) {
$this->_error('缺少场景scene参数');
}
$lists = SubscribeLogic::lists($scene);
return $this->_success('获取成功', $lists);
}
}
@@ -0,0 +1,90 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\TeamLogic;
/**
* 拼团
* Class Team
* @package app\api\controller
*/
class Team extends ApiBase
{
public $like_not_need_login = ['teamGoodsList'];
// 拼团商品列表
public function teamGoodsList()
{
$lists = TeamLogic::getTeamGoodsList($this->page_no, $this->page_size);
if ($lists) {
$this->_success('获取成功', $lists);
} else {
$this->_error(TeamLogic::getError());
}
}
//参与拼团活动
public function buy()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$post['client'] = $this->client;
$check = $this->validate($post, 'app\api\validate\Team.add');
if (true !== $check) {
$this->_error($check);
}
TeamLogic::setUser($this->user_id);
TeamLogic::setTeamId($post['team_id']);
TeamLogic::setTeamGoodsItem($post['item_id']);
TeamLogic::setTeamGoodsNum($post['goods_num']);
TeamLogic::setIntegralConfig();
$info = TeamLogic::calculateInfo($post, $this->user_id);
if ($info === false){
$this->_error(TeamLogic::getError());
}
if($post['action'] == 'info'){
$this->_success('', $info);
}
$order = TeamLogic::buy($this->user_id, $info, $post);
if ($order === false){
$this->_error(TeamLogic::getError());
}
$this->_success('', $order);
}
//验证拼团
public function check()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$check = $this->validate($post, 'app\api\validate\Team.check');
if (true !== $check) {
$this->_error($check);
}
$this->_success();
}
}
@@ -0,0 +1,22 @@
<?php
namespace app\api\controller;
use app\admin\logic\WechatMerchantTransferLogic;
use app\admin\model\WithdrawApply;
class Test extends ApiBase
{
public $like_not_need_login = ['test'];
public function test()
{
$withdraw = WithdrawApply::where('id', 1)->findOrEmpty()->toArray();
$result = WechatMerchantTransferLogic::transfer($withdraw);
// $result = WechatMerchantTransferLogic::details($withdraw);
halt($result);
}
}
+363
View File
@@ -0,0 +1,363 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\UserLogic;
use think\Db;
use app\common\server\UrlServer;
use app\api\logic\SmsLogic;
use app\common\logic\SmsLogic as CommonSmsLogic;
class User extends ApiBase
{
/**
* Notes:个人中心接口
* @author: 2021/3/10 10:13
*/
public function center()
{
$info = UserLogic::center($this->user_id);
$this->_success('获取成功', $info);
}
/**
* Notes:用户信息
* @author: 2021/3/10 10:13
*/
public function info()
{
$this->_success('获取成功', UserLogic::getUserInfo($this->user_id));
}
/**
* Notes:设置用户手机号码
* @author: 2021/3/10 10:13
*/
public function setInfo()
{
$data = $this->request->post();
$data['user_id'] = $this->user_id;
$check = $this->validate($data, 'app\api\validate\UpdateUser.set');
if (true !== $check) {
$this->_error($check);
}
UserLogic::setUserInfo($this->user_id, $data);
$this->_success('操作成功');
}
/**
* Notes:账户流水
* @author: 2021/3/10 10:13
*/
public function accountLog()
{
$source = $this->request->get('source');
$type = $this->request->get('type', 0);
$list = [];
if ($source) {
$list = UserLogic::accountLog($this->user_id, $source, $type, $this->page_no, $this->page_size);
}
$this->_success('获取成功', $list);
}
//更换手机号
public function changeMobile()
{
$data = $this->request->post();
//默认绑定手机号码
$data['message_key'] = 'BDSJHM';
$data['client'] = $this->client;
$validate = 'app\api\validate\ChangeMobile.binding';
//更换手机号码、替换短信key、验证规则
if (isset($data['action']) && 'change' == $data['action']) {
$data['message_key'] = 'BGSJHM';
$validate = 'app\api\validate\ChangeMobile';
}
$data['user_id'] = $this->user_id;
$check = $this->validate($data, $validate);
if (true !== $check) {
$this->_error($check);
}
$res = UserLogic::changeMobile($this->user_id, $data);
if ($res) {
$this->_success('操作成功');
}
$this->_error('操作失败');
}
//获取微信手机号
public function getMobile()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$check = $this->validate($post, 'app\api\validate\WechatMobile');
if (true !== $check) {
$this->_error($check);
}
return UserLogic::getMobileByMnp($post);
}
//我的粉丝
public function fans()
{
$get = $this->request->get();
$page = $this->request->get('page_no', $this->page_no);
$size = $this->request->get('page_size', $this->page_size);
$this->_success('', UserLogic::fans($this->user_id, $get, $page, $size));
}
/**
* note 我的钱包
* create_time 2020/11/27 16:58
*/
public function myWallet()
{
$info = UserLogic::myWallet($this->user_id);
$this->_success('获取成功', $info);
}
/**
* Notes: 我的拼团
* @author 张无忌(2021/1/14 18:43)
*/
public function myTeam()
{
$page = $this->request->get('page_no', $this->page_no);
$size = $this->request->get('page_size', $this->page_size);
$status = $this->request->get('status', -1);
$info = UserLogic::myTeam($this->user_id, $status, $page, $size);
$this->_success('获取成功', $info);
}
/**
* Notes: 更新微信的用户信息
* @author 段誉(2021/4/7 15:28)
*/
public function setWechatInfo()
{
$data = $this->request->post();
$check = $this->validate($data, 'app\api\validate\SetWechatUser');
if (true !== $check) {
$this->_error($check);
}
$res = UserLogic::updateWechatInfo($this->user_id, $data);
if (true === $res) {
$this->_success('操作成功');
}
$this->_error('操作失败');
}
/**
* 设置支付密码
*/
public function setPayPassword()
{
if ($this->request->isPost()) {
$data = $this->request->post();
$result = $this->validate($data, 'app\api\validate\User.setPayPassword');
if (true !== $result) {
$this->_error($result);
}
$data['user_id'] = $this->user_id;
$data['pay_password'] = md5(trim($data['pay_password']));
$result = UserLogic::setPassword($data);
if ($result) {
$this->_success('设置支付密码成功');
} else {
$this->_error('设置支付密码失败');
}
} else {
$this->_error('请求类型错误');
}
}
/**
* 会员转账
*/
public function transfer()
{
$data = $this->request->post();
$data['user_id'] = $this->user_id;
$result = $this->validate($data, 'app\api\validate\User.transfer');
if (true !== $result) {
$this->_error($result);
}
$data['user_id'] = $this->user_id;
$result = UserLogic::transfer($data);
if (true === $result) {
$this->_success('转账成功');
}
$this->_error(UserLogic::getError() ?? '转账失败');
}
/**
* 判断会员是否有设置支付密码
*/
public function hasPayPassword()
{
$payPassword = Db::name('user')->where('id', $this->user_id)->value('pay_password');
if ($payPassword) {
$this->_success('已设置支付密码');
} else {
// 应前端要求,未设置密码show返回0
$this->_error('未设置支付密码', [], 0, 0);
}
}
/**
* 转账记录
*/
public function transferRecord()
{
$get = $this->request->get();
$get['page_no'] = $get['page_no'] ?? $this->page_no;
$get['page_size'] = $get['page_size'] ?? $this->page_size;
$get['user_id'] = $this->user_id;
$get['type'] = $get['type'] ?? 'all';
$result = UserLogic::transferRecord($get);
$this->_success('', $result);
}
/**
* 最近转账(取最近3条)
*/
public function transferRecent()
{
$list = Db::name('user_transfer')->alias('ut')
->distinct(true)
->field('u.sn, u.nickname, u.avatar, ut.create_time')
->leftJoin('user u', 'u.id=ut.transfer_to_id')
->where('ut.transfer_from_id', $this->user_id)
->order('ut.create_time', 'desc')
->group('ut.transfer_to_id')
->limit(3)
->select();
foreach ($list as &$item) {
$item['avatar'] = UrlServer::getFileUrl($item['avatar']);
}
return $this->_success('', $list);
}
/**
* 收款会员信息
*/
public function transferToInfo()
{
$transferTo = $this->request->get('transferTo', '', 'trim');
if (!$transferTo) {
return $this->_error('收款会员信息不能为空');
}
$user = Db::name('user')->field('sn,nickname,avatar')->where('sn', $transferTo)->find();
if (!$user) {
$user = Db::name('user')->field('sn,nickname,avatar')->where('mobile', $transferTo)->find();
if (!$user) {
return $this->_error('收款会员不存在');
}
}
$user['avatar'] = UrlServer::getFileUrl($user['avatar']);
return $this->_success('', $user);
}
/**
* 修改支付密码
*/
public function changePayPassword()
{
$post = $this->request->post();
if (empty($post['origin_pay_password'])) {
return $this->_error('原支付密码不能为空');
}
if (empty($post['new_pay_password'])) {
return $this->_error('新支付密码不能为空');
}
$user = Db::name('user')->where('id', $this->user_id)->find();
if (md5(trim($post['origin_pay_password'])) != $user['pay_password']) {
return $this->_error('原支付密码错误');
}
$result = Db::name('user')->where('id', $this->user_id)->update([
'pay_password' => md5(trim($post['new_pay_password'])),
'update_time' => time()
]);
if ($result) {
return $this->_success('修改成功');
} else {
return $this->_error('修改失败');
}
}
/**
* 找回密码获取验证码
*/
public function send()
{
$mobile = $this->request->post('mobile');
$key = 'ZHZFMM'; // 找回支付密码
$result = $this->validate(['mobile' => $mobile, 'key' => $key], 'app\api\validate\SmsSend');
if ($result !== true) {
$this->_error($result);
}
$send_result = SmsLogic::send($mobile, $key);
if ($send_result !== true) {
$this->_error($send_result);
}
$this->_success('发送成功');
}
/**
* 找回支付密码
*/
public function retrievePayPassword()
{
$post = $this->request->post();
if (empty($post['mobile'])) {
return $this->_error('手机号码不能为空');
}
if (empty($post['code'])) {
return $this->_error('验证码不能为空');
}
if (empty($post['new_pay_password'])) {
return $this->_error('新支付密码不能为空');
}
$sms_logic = new CommonSmsLogic('ZHZFMM', $post['mobile'], $post['code']);
$check = $sms_logic->checkCode();
//检查验证码是否正确
if ($check !== true) {
return $this->_error('验证码错误');
}
//标记验证码已验证
$sms_logic->cancelCode();
// 设置新的支付密码
$result = Db::name('user')->where('id', $this->user_id)->update([
'update_time' => time(),
'pay_password' => md5(trim($post['new_pay_password']))
]);
if ($result) {
return $this->_success('设置成功');
} else {
return $this->_error('设置失败');
}
}
}
@@ -0,0 +1,157 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\UserAddressLogic;
class UserAddress extends ApiBase
{
public $like_not_need_login = ['handleregion'];
//获取地址列表
public function lists()
{
$user_id = $this->user_id;
$result = UserAddressLogic::infoUserAddress($user_id);
$this->_success('获取成功', $result);
}
//获取一条地址详情
public function detail()
{
$get = $this->request->get();
$result = $this->validate($get, 'app\api\validate\UserAddress.one');
if ($result === true) {
$user_id = $this->user_id;
$result = UserAddressLogic::getOneAddress($user_id, $get);
if ($result) {
$this->_success('获取成功', $result);
}
$result = '获取失败';
}
$this->_error($result);
}
//获取默认地址
public function getDefault()
{
$user_id = $this->user_id;
$result = UserAddressLogic::getDefaultAddress($user_id);
if ($result) {
$this->_success('获取成功', $result);
}
$this->_error('获取失败');
}
//设置默认地址
public function setDefault()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\UserAddress.set');
if ($result === true) {
$user_id = $this->user_id;
$result = UserAddressLogic::setDefaultAddress($user_id, $post);
if ($result) {
$this->_success('设置成功', $result);
}
$result = '设置失败';
}
$this->_error($result);
}
//添加收货地址
public function add()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\UserAddress.add');
if ($result === true) {
$user_id = $this->user_id;
$result = UserAddressLogic::addUserAddress($user_id, $post);
if ($result) {
$this->_success('添加成功', $result);
}
$result = '添加失败';
}
$this->_error($result);
}
//更新收货地址
public function update()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\UserAddress.edit');
if ($result === true) {
$user_id = $this->user_id;
$result = UserAddressLogic::editUserAddress($user_id, $post);
if ($result) {
$this->_success('修改成功', $result);
}
$result = '修改失败';
}
$this->_error($result);
}
//删除收货地址
public function del()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\UserAddress.del');
if ($result === true) {
$user_id = $this->user_id;
$result = UserAddressLogic::delUserAddress($user_id, $post);
if ($result) {
$this->_success('删除成功', $result);
}
$result = '删除失败';
}
$this->_error($result);
}
//将省市区名称转换成省市区id
public function handleRegion()
{
$post = $this->request->post();
$result = $this->validate($post, 'app\api\validate\UserAddress.handleRegion');
if ($result === true) {
$province = $this->request->post('province');
$city = $this->request->post('city');
$district = $this->request->post('district');
$res = UserAddressLogic::handleRegion($province, $city, $district);
if ($res) {
$this->_success('获取成功', $res);
}
$result = '获取失败';
}
$this->_error($result);
}
}
@@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\UserLevelLogic;
class UserLevel extends ApiBase{
public function lists(){
$list = UserLevelLogic::lists($this->user_id);
$this->_success('获取成功',$list);
}
}
@@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\WeChatLogic;
class WeChat extends ApiBase
{
public $like_not_need_login = ['jsconfig', 'index'];
/**
* showdoc
* @catalog 接口列表/微信
* @title 微信JSSDK授权接口
* @description
* @method get
* @url we_chat/jsconfig
* @param url 必填 varchar 前端当前url
* @return_param appId string appid,公众号的唯一标识
* @return_param timestamp int 生成签名的时间戳
* @return_param nonceStr string 生成签名的随机串
* @return_param signature string 签名
* @return_param jsApiList array 需要使用的JS接口列表
* @remark allow_share: 传入1时,则返回允许分享到朋友圈的配置
* @number 0
* @return {"code":1,"msg":"获取成功","data":{"config":{"debug":true,"beta":false,"jsApiList":["onMenuShareTimeline","onMenuShareWeibo","openLocation","getLocation","chooseWXPay","updateTimelineShareData"],"appId":"wx9d4……","nonceStr":"Ge8wD……","timestamp":1592707100,"url":"http:\/\/dragon.yixiang……","signature":"8421cfbc……"}}}
*/
public function jsConfig()
{
$url = $this->request->get('url');
$result = WeChatLogic::jsConfig($url);
if ($result['code'] != 1) {
$this->_error( $result['msg'] ?? '', ['config' => $result['data']]);
}
$this->_success('', ['config' => $result['data']]);
}
public function index()
{
$params = $this->request->get();
WeChatLogic::index($params);
}
}
@@ -0,0 +1,68 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 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系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\api\controller;
use app\api\logic\WithdrawLogic;
class Withdraw extends ApiBase
{
//提现申请
public function apply()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$check = $this->validate($post, 'app\api\validate\Withdraw.apply');
if (true !== $check) {
$this->_error($check);
}
return WithdrawLogic::apply($this->user_id, $post);
}
//提现配置
public function config()
{
$data = WithdrawLogic::config($this->user_id);
$this->_success('', $data);
}
//提现记录
public function records()
{
$get = $this->request->get();
$page = $this->request->get('page_no', $this->page_no);
$size = $this->request->get('page_size', $this->page_size);
$res = WithdrawLogic::records($this->user_id, $get, $page, $size);
$this->_success('', $res);
}
//提现详情
public function info()
{
$get = $this->request->get('');
$check = $this->validate($get, 'app\api\validate\Withdraw.info');
if (true !== $check) {
$this->_error($check);
}
$this->_success('', WithdrawLogic::info($get['id'], $this->user_id));
}
}