Browse Source

商品收藏

master
林一峰 7 years ago
parent
commit
a3a1abef0e
  1. 6
      app/Common/Helper.php
  2. 76
      app/Http/Controllers/Api/CollectGoodsController.php
  3. 114
      app/Http/Controllers/Api/CommentController.php
  4. 53
      app/Http/Controllers/Api/FeedBackController.php
  5. 92
      app/Http/Controllers/Api/IndexController.php
  6. 25
      app/Http/Controllers/Api/QrcodeController.php
  7. 442
      app/Http/Controllers/Api/UserController.php
  8. 9
      app/Http/Controllers/Api/UserMoneyController.php
  9. 9
      app/Http/Controllers/Api/UserPointController.php
  10. 43
      app/Http/Controllers/Api/VerifyCodeController.php
  11. 32
      app/Http/Controllers/Auth/ForgotPasswordController.php
  12. 39
      app/Http/Controllers/Auth/LoginController.php
  13. 71
      app/Http/Controllers/Auth/RegisterController.php
  14. 39
      app/Http/Controllers/Auth/ResetPasswordController.php
  15. 3
      app/Http/Controllers/Home/IndexController.php
  16. 2
      app/Http/Model/BaseModel.php
  17. 89
      app/Http/Model/CollectGoods.php
  18. 94
      app/Http/Model/Comment.php
  19. 80
      app/Http/Model/FeedBack.php
  20. 10
      app/Http/Model/Goods.php
  21. 13
      app/Http/Model/GoodsPhoto.php
  22. 10
      app/Http/Model/GoodsType.php
  23. 13
      app/Http/Model/ProductPic.php
  24. 67
      app/Http/Model/Sysconfig.php
  25. 76
      app/Http/Model/User.php
  26. 4
      app/Http/Model/UserAddress.php
  27. 12
      app/Http/Model/UserMoney.php
  28. 12
      app/Http/Model/UserPoint.php
  29. 1
      app/Http/Model/VerifyCode.php
  30. 1
      composer.json
  31. 621
      composer.lock
  32. 6
      config/app.php
  33. 25
      routes/web.php
  34. 5
      说明.txt

6
app/Common/Helper.php

@ -164,6 +164,12 @@ class Helper
return $result;
}
//生成二维码
public static function qrcode($url,$size=150)
{
return 'data:image/png;base64,'.base64_encode(\QrCode::format('png')->encoding('UTF-8')->size($size)->margin(0)->errorCorrection('H')->generate($url));
}
//获取浏览器信息
public static function getBrowser()

76
app/Http/Controllers/Api/CollectGoodsController.php

@ -0,0 +1,76 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\CollectGoods;
class CollectGoodsController extends CommonController
{
public function __construct()
{
parent::__construct();
}
public function collectGoodsList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$data['user_id'] = Token::$uid;
$res = CollectGoods::getList($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//收藏商品
public function collectGoodsAdd(Request $request)
{
//参数
$data['goods_id'] = $request->input('goods_id',null);
if($request->input('is_attention', null) !== null){$data['is_attention'] = $request->input('is_attention');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
if($data['goods_id']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = CollectGoods::add($data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//取消收藏商品
public function collectGoodsDelete(Request $request)
{
//参数
$data['goods_id'] = $request->input('goods_id',null);
$data['user_id'] = Token::$uid;
if($data['goods_id']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = CollectGoods::remove($data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
}

114
app/Http/Controllers/Api/CommentController.php

@ -0,0 +1,114 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\Comment;
class CommentController extends CommonController
{
public function __construct()
{
parent::__construct();
}
public function goodsCommentList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$data['user_id'] = Token::$uid;
$data['comment_type'] = $request->input('comment_type', 0); //0商品评价,1文章评价
if($request->input('comment_rank', null) !== null){$data['comment_rank'] = $request->input('comment_rank');}
$res = Comment::getList($data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//添加评价
public function goodsCommentAdd(Request $request)
{
//参数
$data['comment_type'] = $request->input('comment_type',0);
$data['id_value'] = $request->input('id_value',null);
$data['content'] = $request->input('content',null);
$data['comment_rank'] = $request->input('comment_rank',null);
if($request->input('email', null) !== null){$data['email'] = $request->input('email');}
if($request->input('user_name', null) !== null){$data['user_name'] = $request->input('user_name');}
if($request->input('ip_address', null) !== null){$data['ip_address'] = $request->input('ip_address');}
if($request->input('parent_id', null) !== null){$data['parent_id'] = $request->input('parent_id');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
if($data['comment_type']===null || $data['id_value']===null || $data['content']===null || $data['comment_rank']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = Comment::add($data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
public function goodsCommentUpdate(Request $request)
{
//参数
$id = $request->input('id',null);
$data['comment_type'] = $request->input('comment_type',0);
$data['id_value'] = $request->input('id_value',null);
$data['content'] = $request->input('content',null);
$data['comment_rank'] = $request->input('comment_rank',null);
if($request->input('email', null) !== null){$data['email'] = $request->input('email');}
if($request->input('user_name', null) !== null){$data['user_name'] = $request->input('user_name');}
if($request->input('ip_address', null) !== null){$data['ip_address'] = $request->input('ip_address');}
if($request->input('parent_id', null) !== null){$data['parent_id'] = $request->input('parent_id');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
if($id===null || $data['comment_type']===null || $data['id_value']===null || $data['content']===null || $data['comment_rank']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = Comment::modify(array('id'=>$id),$data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//删除评价
public function goodsCommentDelete(Request $request)
{
//参数
$data['comment_type'] = $request->input('comment_type',null);
$data['id_value'] = $request->input('id_value',null);
$data['user_id'] = Token::$uid;
if($data['comment_type']===null || $data['id_value']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = Comment::remove($data);
if($res !== true)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
}

53
app/Http/Controllers/Api/FeedBackController.php

@ -0,0 +1,53 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\FeedBack;
class FeedBackController extends CommonController
{
public function __construct()
{
parent::__construct();
}
public function feedbackList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$res = FeedBack::getList($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//添加意见反馈
public function feedbackAdd(Request $request)
{
//参数
$data['content'] = $request->input('content',null);
if($request->input('title', null) !== null){$data['title'] = $request->input('title');}
$data['user_id'] = Token::$uid;
if($data['content']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = FeedBack::add($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
}

92
app/Http/Controllers/Api/IndexController.php

@ -2,7 +2,9 @@
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
class IndexController extends CommonController
{
@ -10,79 +12,21 @@ class IndexController extends CommonController
{
parent::__construct();
}
//文章列表页
public function listarc()
//安卓升级信息
public function andriodUpgrade()
{
$res["code"] = 0;
$res["msg"] = "success";
$res["data"] = "";
$where = array();
$result = "";
$PageIndex = request('PageIndex',1);
$PageSize = request('PageSize', sysconfig('CMS_PAGESIZE'));
$skip = ($PageIndex-1)*$PageSize;
$typeid = request('typeid');if(!empty($typeid)){ $where['typeid']=$typeid; }
$tuijian = request('tuijian');if(!empty($tuijian)){ $where['tuijian']=$tuijian; }
$field = array('field','id,typeid,click,title,writer,litpic,pubdate');
$orderby = request('orderby',['pubdate','desc']);
$mname = request('mname','article');
$model = DB::table($mname);
if($where){$model = $model->where($where);}
if($orderby == 'rand()'){$model = $model->orderBy(\DB::raw('rand()'));}else{$model = $model->orderBy($orderby[0], $orderby[1]);}
$count = $model->count();
$list = object_to_array($model->skip($skip)->take($PageSize)->get());
if(!empty($list) && $PageIndex<=10)
{
/* foreach($list as $key=>$row)
{
//$list[$key]["pubdate"] = date("Y-m-d", $list[$key]["pubdate"]);
$result .= '<div class="list">';
if(!empty($row['litpic']) && file_exists($_SERVER['DOCUMENT_ROOT'].$row['litpic']))
{
$result .= '<a class="';
//判断图片长宽
if(getimagesize($row['litpic'])[0]>getimagesize($row['litpic'])[1])
{
$result .= 'limg';
}
else
{
$result .= 'simg';
}
$result .= '" href="'.WEBHOST.'/p/'.$row['id'].'"><img alt="'.$row['title'].'" src="'.$row['litpic'].'"></a>';
}
$result .= '<strong class="tit"><a href="'.WEBHOST.'/p/'.$row['id'].'">'.$row['title'].'</a></strong><p>'.mb_strcut(strip_tags($row['description']),0,126,'UTF-8').'..<a href="'.WEBHOST.'/p/'.$row['id'].'" class="more">[详情]</a></p>';
$result .= '<div class="info"><span class="fl"><i class="pub-v"></i><em>'.date("Y-m-d H:i",$row['pubdate']).'</em></span><span class="fr"><em>'.$row['click'].'</em>人阅读</span></div><div class="cl"></div></div>';
} */
foreach($list as $key=>$row)
{
$list[$key]["url"] = get_front_url(array("id"=>$row['id'],"type"=>'content'));
$list[$key]["pubdate"] = date("Y-m-d", $list[$key]["pubdate"]);
}
$res["data"] = $list;
}
/* $result['List']=$list;
$result['Count']=$count>0?$count:0; */
//return $res;
exit(json_encode($res));
$res = array(
'appname' => 'lqycms', //app名字
'serverVersion' => 2, //服务器版本号
'serverFlag' => 1, //服务器标志
'lastForce' => 0, //是否强制更新,0不强制,1强制
'updateurl' => 'http://api.52danchuang.com/wap/app-release.apk', //apk下载地址
'upgradeinfo' => '描述:3.0.0' //版本更新的描述
);
return ReturnData::create(ReturnData::SUCCESS, $res);
}
//测试页面
public function test()
{
return date("Y-m-d H:i:s",strtotime("2017-04"));
}
}

25
app/Http/Controllers/Api/QrcodeController.php

@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;
//二维码
class QrcodeController extends CommonController
{
public function __construct()
{
parent::__construct();
}
public function createSimpleQrcode(Request $request)
{
//参数
$url = $request->input('url');
$size = $request->input('size', 150);
return '<img src="'.Helper::qrcode($url,$size).'">';
}
}

442
app/Http/Controllers/Api/UserController.php

@ -4,7 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\User;
class UserController extends CommonController
@ -14,109 +14,417 @@ class UserController extends CommonController
parent::__construct();
}
//用户信息
public function userInfo(Request $request)
{
if ($user = User::getOne(Token::$uid))
{
return ReturnData::create(ReturnData::SUCCESS, $user);
}
else
{
return ReturnData::create(ReturnData::RECORD_NOT_EXIST);
}
}
//修改用户信息
public function updateUserInfo(Request $request)
{
$data = $data2 = '';
if($request->input('sex', null)!=null){$data['sex'] = $request->input('sex');}
if($request->input('head_img', null)!=null){$data['head_img'] = $request->input('head_img');}
if($request->input('name', null)!=null){$data['name'] = $request->input('name');}
if($request->input('nickname', null)!=null){$data['nickname'] = $request->input('nickname');}
if($request->input('verify_mobile', null)!=null){$data['verify_mobile'] = $request->input('verify_mobile');}
if($request->input('community_id', null)!=null){$data['community_id'] = $request->input('community_id');}
if($request->input('address', null)!=null){$data['address'] = $request->input('address');}
if ($data != '')
{
MallDataManager::userUpdate(['id'=>Token::$uid],$data);
}
return ReturnCode::create(ReturnCode::SUCCESS);
}
//用户列表
public function userList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$res = User::getList($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//签到
public function signin(Request $request)
{
$user = MallDataManager::userFirst(['id'=>Token::$uid]);
if($user){}else{return ReturnCode::create(ReturnCode::PARAMS_ERROR);}
$res = User::signin();
if($res !== true)
{
return ReturnData::create(ReturnData::PARAMS_ERROR,null,$res);
}
return ReturnData::create(ReturnData::SUCCESS);
}
//注册
public function register(Request $request)
{
$mobile = $request->input('mobile', null);
$password = $request->input('password', null);
$community_id = $request->input('community_id', null);
$address = $request->input('address', null);
$type = $request->input('type', null);
$verificationCode = $request->input('verificationCode', null);
$verificationType = $request->input('verificationType', null); //7表示验证码登录
$yezhu_mobile = $request->input('yezhu_mobile', null);
Log::info("注册手机号==========mobile=======".$mobile);
if ($mobile==null || $password==null || $verificationCode==null || $verificationType===null || $community_id===null)
{
return ReturnCode::create(ReturnCode::PARAMS_ERROR);
}
if (!Helper::isValidMobile($mobile))
{
return response(ReturnCode::create(ReturnCode::MOBILE_FORMAT_FAIL));
}
$signin_time='';
if(!empty($user->signin_time)){$signin_time = date('Ymd',strtotime($user->signin_time));} //签到时间
$verifyCode = VerifyCode::isVerify($mobile, $verificationCode, $verificationType);
if(!$verifyCode)
{
return ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE);
}
$today = date('Ymd',time()); //今日日期
if($yezhu_mobile!=null)
{
$yezhu = MallDataManager::userFirst(['mobile'=>$yezhu_mobile,'community_id'=>$community_id]);
if (!$yezhu)
{
return response(ReturnCode::create(ReturnCode::PARAMS_ERROR,'业主不匹配'));
}
}
if($signin_time==$today){return ReturnCode::create(101,'已经签到啦,请明天再来!');}
//判断是否已经注册
$user = MallDataManager::userFirst(['mobile'=>$mobile]);
if ($user)
{
return response(ReturnCode::create(ReturnCode::MOBILE_EXIST));
}
$signin_point = (int)DB::table('system')->where(['keyword'=>'signin_point'])->value('value'); //签到积分
DB::table('user')->where(['id'=>Token::$uid])->update(['point'=>($user->point+$signin_point),'signin_time'=>date('Y-m-d H:i:s')]); //更新用户积分,及签到时间
DB::table('user_point_log')->insert(['type'=>1,'point'=>$signin_point,'des'=>'签到','user_id'=>Token::$uid]); //添加签到积分记录
try
{
DB::beginTransaction();
//创建用户
$userdata['mobile'] = $mobile;
$userdata['password'] = $password;
$userdata['verify_mobile'] = 1;
$userdata['name'] = $mobile;
$userdata['nickname'] = $mobile;
$userdata['community_id'] = $community_id;
$userdata['address'] = $address;
$userdata['type'] = $type;
$userid = DB::table('user')->insertGetId($userdata);
//注册环信用户
$Easemob = new Easemob();
$Easemob->imRegister(['username'=>'cuobian'.$userid,'password'=>md5('cuobian'.$userid)]);
//生成token
if ($user = MallDataManager::userFirst(['mobile'=>$mobile,'password'=>$password]))
{
//获取token
$expired_at = Carbon::now()->addDay()->toDateTimeString();
$token = Token::generate(Token::TYPE_SHOP, $user->id);
}
DB::commit();
$response = ReturnCode::create(ReturnCode::SUCCESS);
$response['data'] = [
'id' => $user->id,
'mobile' => $user->mobile,
'expired_at' => $expired_at,
'token' => $token,
];
}
catch (Exception $e)
{
DB::rollBack();
Log::info($e->getMessage());
return response(ReturnCode::error($e->getCode(), $e->getMessage()));
}
return response($response);
}
//登录
public function login(Request $request)
{
$mobile = $request->input('mobile');
$password = $request->input('password');
return ReturnCode::create(ReturnCode::SUCCESS,'恭喜您今日签到成功!+'.$signin_point.'积分');
if (!$mobile || !$password)
{
return response(ReturnCode::create(ReturnCode::PARAMS_ERROR));
}
if ($user = MallDataManager::userFirst(['mobile'=>$mobile]))
{
//判断密码
if ($password == $user->password)
{
//获取token
$expired_at = Carbon::now()->addDay()->toDateTimeString();
$token = Token::generate(Token::TYPE_SHOP, $user->id);
$response = ReturnCode::success();
$response['data']=[
'id' => $user->id, 'name' => $user->name, 'nickname' => $user->nickname, 'headimg' => (string)$user->head_img, 'token' => $token, 'expired_at' => $expired_at, 'mobile' => $user->mobile, 'hx_name' => 'cuobian'.$user->id, 'hx_pwd' => md5('cuobian'.$user->id)
];
return response($response);
}
else
{
return response(ReturnCode::create(ReturnCode::PASSWORD_NOT_MATCH));
}
}
else
{
return response(ReturnCode::create(ReturnCode::USER_NOT_EXIST));
}
}
//验证码校验
public function verifyCodeCheck(Request $request)
//验证码登录
public function verificationCodeLogin(Request $request)
{
$mobile = $request->input('mobile', null); //手机号码
$verificationCode = $request->input('verificationCode', null); //手机验证码
$type = $request->input('type', null); //验证码类型
$mobile = $request->input('mobile');
$code = $request->input('code', null);
$type = $request->input('type', null); //7表示验证码登录
if (!$mobile || !$code)
{
return response(ReturnCode::create(ReturnCode::PARAMS_ERROR));
}
//判断验证码
if ($type != VerifyCode::TYPE_LOGIN)
{
return response(ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE));
}
if ($mobile==null || $verificationCode==null || $type==null)
$verifyCode = VerifyCode::isVerify($mobile, $code, $type);
if (!$verifyCode)
{
return response(ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE));
}
if ($user = MallDataManager::userFirst(['mobile'=>$mobile]))
{
//获取token
$expired_at = Carbon::now()->addDay()->toDateTimeString();
$token = Token::generate(Token::TYPE_SHOP, $user->id);
$response = ReturnCode::success();
$response['data']=[
'id' => $user->id, 'name' => $user->name, 'nickname' => $user->nickname, 'headimg' => (string)$user->head_img, 'token' => $token, 'expired_at' => $expired_at, 'mobile' => $user->mobile, 'hx_name' => 'cuobian'.$user->id, 'hx_pwd' => md5('cuobian'.$user->id)
];
return response($response);
}
else
{
return response(ReturnCode::create(ReturnCode::USER_NOT_EXIST));
}
}
//修改密码
public function changePassword(Request $request)
{
$mobile = $request->input('mobile', null);
$password = $request->input('password', null); //新密码
$oldPassword = $request->input('oldPassword', null); //旧密码
if (!$mobile || !$password || !$oldPassword)
{
return ReturnCode::create(ReturnCode::PARAMS_ERROR);
}
if($password == $oldPassword)
{
return ReturnCode::create(ReturnCode::PARAMS_ERROR,'新旧密码相同');
}
if (!Helper::isValidMobile($mobile))
{
return ReturnCode::create(ReturnCode::MOBILE_FORMAT_FAIL);
}
$verifyCode = VerifyCode::isVerify($mobile, $verificationCode, $type);
if(!$verifyCode)
$user = MallDataManager::userFirst(['mobile'=>$mobile,'password'=>$oldPassword,'id'=>Token::$uid]);
if(!$user)
{
return ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE);
return ReturnCode::create(ReturnCode::PARAMS_ERROR,'手机或密码错误');
}
DB::table('user')->where(['mobile'=>$mobile,'password'=>$oldPassword,'id'=>Token::$uid])->update(['password'=>$password]);
MallDataManager::tokenDelete(['uid'=>Token::$uid]);
return ReturnCode::create(ReturnCode::SUCCESS);
}
//积分记录
public function getCommunityNoticeList(Request $request)
//找回密码,不用输入旧密码
public function findPassword(Request $request)
{
$where = '';
$page = $request->input('page',1);
$size = $request->input('size',10);
$skip = ($page-1)*$size;
$mobile = $request->input('mobile', null);
$password = $request->input('password', null);
$select = ['id','title','des','litpic','type','created_at as time'];
$orderBy = ['id','desc'];
return ReturnCode::create(ReturnCode::SUCCESS,MallDataManager::getCommunityNoticeList($where,$select,$orderBy,$skip,$size));
if ($mobile && $password)
{
if (!Helper::isValidMobile($mobile))
{
return response(ReturnCode::create(ReturnCode::MOBILE_FORMAT_FAIL));
}
//判断验证码是否有效
$code = $request->input('code', '');
$type = $request->input('type', null);
if($type != VerifyCode::TYPE_CHANGE_PASSWORD)
return response(ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE,'验证码类型错误'));
$verifyCode = VerifyCode::isVerify($mobile, $code, $type);
if($verifyCode)
{
try
{
DB::beginTransaction();
$verifyCode->status = VerifyCode::STATUS_USE;
$verifyCode->save();
if ($user = MallDataManager::userFirst(['mobile'=>$mobile]))
{
DB::table('user')->where(['mobile'=>$mobile])->update(['password'=>$password]);
MallDataManager::tokenDelete(['uid'=>$user->id]);
$response = response(ReturnCode::create(ReturnCode::SUCCESS));
}
else
{
$response = response(ReturnCode::create(ReturnCode::PARAMS_ERROR));
}
DB::commit();
return $response;
}
catch (Exception $e)
{
DB::rollBack();
return response(ReturnCode::error($e->getCode(), $e->getMessage()));
}
}
else
{
return response(ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE));
}
}
else
{
return response(ReturnCode::create(ReturnCode::PARAMS_ERROR));
}
}
//用户收货地址列表
public function userAddressList(Request $request)
{
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
$res = UserAddress::getList($data);
if(!$res)
//用户意见反馈
public function feedback(Request $request)
{
$content = $request->input('content', null);
if(!$content)
return response(ReturnCode::create(ReturnCode::PARAMS_ERROR));
if ($user = MallDataManager::userFirst(['id'=>Token::$uid]))
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
$id = MallDataManager::mallFeedbackinsertGetId(['content' => $content, 'user_id' => Token::$uid]);
return response(ReturnCode::create(ReturnCode::SUCCESS,$id));
}
else
{
return response(ReturnCode::create(ReturnCode::AUTHORIZE_FAIL));
}
}
//用户收货地址详情
public function userAddressDetail(Request $request)
{
//参数
$id = $request->input('id',null);
$res = UserAddress::getOne($id);
if(!$res)
//关于
public function about(Request $request)
{
return response(ReturnCode::create(ReturnCode::SUCCESS,['url'=>'http://www.baidu.com']));
}
//修改手机号
public function changeMobile(Request $request)
{
$mobile = $request->input('mobile', null); //新手机号码
$verificationCode = $request->input('verificationCode', null); //新手机验证码
$oldMobile = $request->input('oldMobile', null); //旧手机号码
$oldVerificationCode = $request->input('oldVerificationCode', null); //旧手机验证码
$type = $request->input('type', null); //验证码类型
if (!$mobile || !$verificationCode || !$oldMobile || !$oldVerificationCode || !$type)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
return ReturnCode::create(ReturnCode::PARAMS_ERROR);
}
if (!Helper::isValidMobile($mobile))
{
return ReturnCode::create(ReturnCode::MOBILE_FORMAT_FAIL);
}
return ReturnData::create(ReturnData::SUCCESS,$res);
}
//设为默认地址
public function userAddressSetDefault(Request $request)
{
//参数
$id = $request->input('id',null);
$res = UserAddress::setDefault($id);
if(!$res)
if($mobile == $oldMobile)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);
return ReturnCode::create(ReturnCode::PARAMS_ERROR,'新旧手机号码相同');
}
return ReturnData::create(ReturnData::SUCCESS,$res);
if($type != VerifyCode::TYPE_CHANGE_MOBILE)
{
return ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE,'验证码类型错误');
}
$verifyCode = VerifyCode::isVerify($oldMobile, $oldVerificationCode, $type);
if(!$verifyCode)
{
return ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE);
}
$verifyCode = null;
$verifyCode = VerifyCode::isVerify($mobile, $verificationCode, $type);
if(!$verifyCode)
{
return ReturnCode::create(ReturnCode::INVALID_VERIFY_CODE);
}
$user = MallDataManager::userFirst(['mobile'=>$oldMobile,'id'=>Token::$uid]);
if(!$user)
{
return ReturnCode::create(ReturnCode::PARAMS_ERROR,'旧手机号码错误');
}
DB::table('user')->where(['mobile'=>$oldMobile,'id'=>Token::$uid])->update(['mobile'=>$mobile]);
MallDataManager::tokenDelete(['uid'=>Token::$uid]);
return ReturnCode::create(ReturnCode::SUCCESS);
}
//添加收货地址

9
app/Http/Controllers/Api/UserMoneyController.php

@ -4,7 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\UserMoney;
class UserMoneyController extends CommonController
@ -19,7 +19,7 @@ class UserMoneyController extends CommonController
//参数
$data['limit'] = $request->input('limit', 10);
$data['offset'] = $request->input('offset', 0);
if($request->input('type', null) !== null){$data['type'] = $request->input('type');};
if($request->input('type', null) !== null){$data['type'] = $request->input('type');}
$res = UserMoney::getList($data);
if(!$res)
@ -34,11 +34,12 @@ class UserMoneyController extends CommonController
public function userMoneyAdd(Request $request)
{
//参数
$data['user_id'] = Token::$uid;
$data['type'] = $request->input('type',null);
$data['money'] = $request->input('money',null);
$data['add_time'] = time();
$data['des'] = $request->input('des',null);
if($request->input('user_money', null) !== null){$data['user_money'] = $request->input('user_money');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
if($data['type']===null || $data['money']===null || $data['des']===null)
{

9
app/Http/Controllers/Api/UserPointController.php

@ -4,7 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\UserPoint;
class UserPointController extends CommonController
@ -34,18 +34,19 @@ class UserPointController extends CommonController
public function userPointAdd(Request $request)
{
//参数
$data['user_id'] = Token::$uid;
$data['type'] = $request->input('type',null);
$data['point'] = $request->input('point',null);
$data['add_time'] = time();
$data['des'] = $request->input('des',null);
if($request->input('user_point', null) !== null){$data['user_point'] = $request->input('user_point');}
$data['add_time'] = time();
$data['user_id'] = Token::$uid;
if($data['type']===null || $data['point']===null || $data['des']===null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
$res = UserMoney::add($data);
$res = UserPoint::add($data);
if(!$res)
{
return ReturnData::create(ReturnData::SYSTEM_FAIL);

43
app/Http/Controllers/Api/VerifyCodeController.php

@ -0,0 +1,43 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Api\CommonController;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;
use App\Http\Model\VerifyCode;
class VerifyCodeController extends CommonController
{
public function __construct()
{
parent::__construct();
}
//验证码校验
public function check(Request $request)
{
$mobile = $request->input('mobile', null); //手机号码
$verifyCode = $request->input('verifyCode', null); //手机验证码
$type = $request->input('type', null); //验证码类型
if ($mobile==null || $verifyCode==null || $type==null)
{
return ReturnData::create(ReturnData::PARAMS_ERROR);
}
if (!Helper::isValidMobile($mobile))
{
return ReturnData::create(ReturnData::MOBILE_FORMAT_FAIL);
}
$verifyCode = VerifyCode::isVerify($mobile, $verifyCode, $type);
if(!$verifyCode)
{
return ReturnData::create(ReturnData::INVALID_VERIFYCODE);
}
return ReturnData::create(ReturnData::SUCCESS);
}
}

32
app/Http/Controllers/Auth/ForgotPasswordController.php

@ -1,32 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

39
app/Http/Controllers/Auth/LoginController.php

@ -1,39 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
}

71
app/Http/Controllers/Auth/RegisterController.php

@ -1,71 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}

39
app/Http/Controllers/Auth/ResetPasswordController.php

@ -1,39 +0,0 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

3
app/Http/Controllers/Home/IndexController.php

@ -259,6 +259,9 @@ class IndexController extends CommonController
//测试页面
public function test()
{
$qrcode = new \SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
return $qrcode->size(500)->generate('Make a qrcode without Laravel!');
//return '<img src="data:image/png;base64,'.base64_encode(\QrCode::format('png')->encoding('UTF-8')->size(200)->generate('http://www.72p.org/')).'">';
//set_exception_handler('myException');
//return uniqid();
//return \App\Common\Helper::formatPrice(1.2346);

2
app/Http/Model/BaseModel.php

@ -6,4 +6,4 @@ use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
}
}

89
app/Http/Model/CollectGoods.php

@ -0,0 +1,89 @@
<?php
namespace App\Http\Model;
use App\Common\Token;
class CollectGoods extends BaseModel
{
//商品收藏
protected $table = 'collect_goods';
public $timestamps = false;
/**
* 不能被批量赋值的属性
*
* @var array
*/
protected $guarded = [];
//获取列表
public static function getList(array $param)
{
extract($param); //参数:limit,offset
$where['user_id'] = Token::$uid;
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = new CollectGoods;
if(isset($type)){$where['type'] = $type;}
$model = $model->where($where);
$res['count'] = $model->count();
$res['list'] = array();
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
return false;
}
return $res;
}
public static function getOne($id)
{
return self::where('id', $id)->first()->toArray();
}
public static function add(array $data)
{
if(self::where(array('user_id'=>$data['user_id'],'goods_id'=>$data['goods_id']))->first()){return '亲,您已经收藏啦!';}
if ($id = self::insertGetId($data))
{
return true;
}
return false;
}
public static function modify($where, array $data)
{
if (self::where($where)->update($data))
{
return true;
}
return false;
}
//删除一条记录
public static function remove(array $data)
{
if(!self::where(array('user_id'=>$data['user_id'],'goods_id'=>$data['goods_id']))->first()){return '商品未收藏';}
if (!self::where(array('user_id'=>$data['user_id'],'goods_id'=>$data['goods_id']))->delete())
{
return false;
}
return true;
}
}

94
app/Http/Model/Comment.php

@ -0,0 +1,94 @@
<?php
namespace App\Http\Model;
use App\Common\Token;
class Comment extends BaseModel
{
//评价
protected $table = 'comment';
public $timestamps = false;
/**
* 不能被批量赋值的属性
*
* @var array
*/
protected $guarded = [];
const SHOW_COMMENT = 1; //评论已审核
//获取列表
public static function getList(array $param)
{
extract($param); //参数:limit,offset
$where['user_id'] = Token::$uid;
$where['comment_type'] = $comment_type; //0商品评价,1文章评价
$where['status'] = self::SHOW_COMMENT;
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = new Comment;
if(isset($comment_rank)){$where['comment_rank'] = $comment_rank;} //评价分
$model = $model->where($where);
$res['count'] = $model->count();
$res['list'] = array();
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
return '暂无记录';
}
return $res;
}
public static function getOne($id)
{
return self::where('id', $id)->first()->toArray();
}
public static function add(array $data)
{
if(self::where(array('user_id'=>$data['user_id'],'id_value'=>$data['id_value'],'comment_type'=>$data['comment_type']))->first()){return '亲,您已经评价啦!';}
if ($id = self::insertGetId($data))
{
return true;
}
return false;
}
public static function modify($where, array $data)
{
if (self::where($where)->update($data))
{
return true;
}
return false;
}
//删除一条记录
public static function remove(array $data)
{
if(!self::where(array('user_id'=>$data['user_id'],'comment_type'=>$data['comment_type'],'id_value'=>$data['id_value']))->first()){return '商品尚未评价';}
if (!self::where(array('user_id'=>$data['user_id'],'comment_type'=>$data['comment_type'],'id_value'=>$data['id_value']))->delete())
{
return false;
}
return true;
}
}

80
app/Http/Model/FeedBack.php

@ -0,0 +1,80 @@
<?php
namespace App\Http\Model;
use App\Common\Token;
class FeedBack extends BaseModel
{
//用户余额明细
protected $table = 'feedback';
public $timestamps = false;
/**
* 不能被批量赋值的属性
*
* @var array
*/
protected $guarded = [];
//获取列表
public static function getList(array $param)
{
extract($param); //参数:limit,offset
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = new FeedBack;
$res['count'] = $model->count();
$res['list'] = array();
if($res['count']>0)
{
$res['list'] = $model->select('title','created_at')->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
return false;
}
return $res;
}
public static function getOne($id)
{
return self::where('id', $id)->first()->toArray();
}
public static function add(array $data)
{
if ($id = self::insertGetId($data))
{
return $id;
}
return false;
}
public static function modify($where, array $data)
{
if (self::where($where)->update($data))
{
return true;
}
return false;
}
//删除一条记录
public static function remove($id)
{
if (!self::whereIn('id', explode(',', $id))->delete())
{
return false;
}
return true;
}
}

10
app/Http/Model/Product.php → app/Http/Model/Goods.php

@ -1,9 +1,9 @@
<?php
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
use App\Common\Token;
class Product extends Model
class Goods extends BaseModel
{
//产品模型
@ -12,7 +12,7 @@ class Product extends Model
*
* @var string
*/
protected $table = 'product';
protected $table = 'goods';
/**
* 表明模型是否应该被打上时间戳
@ -35,9 +35,9 @@ class Product extends Model
/**
* 获取关联到产品的分类
*/
public function producttype()
public function goodstype()
{
return $this->belongsTo(ProductType::class, 'typeid', 'id');
return $this->belongsTo(GoodsType::class, 'typeid', 'id');
}
}

13
app/Http/Model/GoodsPhoto.php

@ -0,0 +1,13 @@
<?php
namespace App\Http\Model;
use App\Common\Token;
class GoodsPhoto extends BaseModel
{
//产品图片
protected $table = 'goods_photo';
public $timestamps = false;
}

10
app/Http/Model/ProductType.php → app/Http/Model/GoodsType.php

@ -1,9 +1,9 @@
<?php
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
use App\Common\Token;
class ProductType extends Model
class GoodsType extends BaseModel
{
//产品分类模型
@ -12,15 +12,15 @@ class ProductType extends Model
*
* @var string
*/
protected $table = 'product_type';
protected $table = 'goods_type';
public $timestamps = false;
/**
* 获取分类对应的产品
*/
public function product()
public function goods()
{
return $this->hasMany(ProductType::class, 'typeid', 'id');
return $this->hasMany(GoodsType::class, 'typeid', 'id');
}
}

13
app/Http/Model/ProductPic.php

@ -1,13 +0,0 @@
<?php
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
class ProductPic extends Model
{
//产品图片
protected $table = 'product_pic';
public $timestamps = false;
}

67
app/Http/Model/Sysconfig.php

@ -1,9 +1,9 @@
<?php
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
use App\Common\Token;
class Sysconfig extends Model
class Sysconfig extends BaseModel
{
//系统参数配置
@ -16,4 +16,65 @@ class Sysconfig extends Model
* @var array
*/
protected $guarded = [];
}
//获取列表
public static function getList(array $param)
{
extract($param); //参数:limit,offset
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = new Sysconfig;
$res['count'] = $model->count();
$res['list'] = array();
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
return false;
}
return $res;
}
public static function getOne($id)
{
return self::where('id', $id)->first()->toArray();
}
public static function add(array $data)
{
if ($id = self::insertGetId($data))
{
return $id;
}
return false;
}
public static function modify($where, array $data)
{
if (self::where($where)->update($data))
{
return true;
}
return false;
}
//删除一条记录
public static function remove($id)
{
if (!self::whereIn('id', explode(',', $id))->delete())
{
return false;
}
return true;
}
}

76
app/Http/Model/User.php

@ -43,4 +43,78 @@ class User extends BaseModel
return true;
}
}
//获取列表
public static function getList(array $param)
{
extract($param); //参数:limit,offset
$where = '';
$limit = isset($limit) ? $limit : 10;
$offset = isset($offset) ? $offset : 0;
$model = new User;
if(isset($group_id)){$where['group_id'] = $group_id;}
if($where != '')
{
$model = $model->where($where);
}
$res['count'] = $model->count();
$res['list'] = array();
if($res['count']>0)
{
$res['list'] = $model->select('id','user_name','email','sex','money','point','mobile','nickname','add_time')->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
return false;
}
return $res;
}
//用户信息
public static function getOne($id)
{
$user = self::where('id', $id)->first();
if(!$user){return false;}
$user['reciever_address'] = UserAddress::getOne($user->address_id);
return $user;
}
public static function add(array $data)
{
if ($id = self::insertGetId($data))
{
return $id;
}
return false;
}
public static function modify($where, array $data)
{
if (self::where($where)->update($data))
{
return true;
}
return false;
}
//删除一条记录
public static function remove($id)
{
if (!self::whereIn('id', explode(',', $id))->delete())
{
return false;
}
return true;
}
}

4
app/Http/Model/UserAddress.php

@ -56,7 +56,7 @@ class UserAddress extends BaseModel
}
//获取一条记录,不传address_id表示获取默认地址
public static function getOne($address_id)
public static function getOne($address_id='')
{
$arr = '';
@ -79,7 +79,7 @@ class UserAddress extends BaseModel
{
// 取默认地址
$arr = self::join('user','user_address.id', '=', 'user.address_id')
->where('user.user_id',Token::$uid)
->where('user.id',Token::$uid)->select('user_address.id','user_address.name','country','province','city','district','address','user_address.mobile','zipcode','best_time')
->first();
if($arr)

12
app/Http/Model/UserMoney.php

@ -38,7 +38,7 @@ class UserMoney extends BaseModel
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->get()->toArray();
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
@ -48,9 +48,14 @@ class UserMoney extends BaseModel
return $res;
}
public static function getOne($id)
{
return self::where('id', $id)->first()->toArray();
}
public static function add(array $data)
{
if ($id = DB::table(self::$table)->insertGetId($data))
if ($id = self::insertGetId($data))
{
return $id;
}
@ -60,8 +65,7 @@ class UserMoney extends BaseModel
public static function modify($where, array $data)
{
$slide = DB::table(self::$table);
if ($slide->where($where)->update($data))
if (self::where($where)->update($data))
{
return true;
}

12
app/Http/Model/UserPoint.php

@ -37,7 +37,7 @@ class UserPoint extends BaseModel
if($res['count']>0)
{
$res['list'] = $model->skip($offset)->take($limit)->get()->toArray();
$res['list'] = $model->skip($offset)->take($limit)->orderBy('id','desc')->get()->toArray();
}
else
{
@ -47,9 +47,14 @@ class UserPoint extends BaseModel
return $res;
}
public static function getOne($id)
{
return self::where('id', $id)->first()->toArray();
}
public static function add(array $data)
{
if ($id = DB::table(self::$table)->insertGetId($data))
if ($id = self::insertGetId($data))
{
return $id;
}
@ -59,8 +64,7 @@ class UserPoint extends BaseModel
public static function modify($where, array $data)
{
$slide = DB::table(self::$table);
if ($slide->where($where)->update($data))
if (self::where($where)->update($data))
{
return true;
}

1
app/Http/Model/VerifyCode.php

@ -6,6 +6,7 @@ use App\Common\Sms;
use App\Common\Helper;
use App\Common\ReturnData;
//验证码
class VerifyCode extends BaseModel
{
protected $table = 'verify_code';

1
composer.json

@ -11,6 +11,7 @@
"laravel/tinker": "~1.0",
"maatwebsite/excel": "~2.1.0",
"overtrue/laravel-wechat": "~3.1",
"simplesoftwareio/simple-qrcode": "~1",
"jpush/jpush": "v3.5.*"
},
"require-dev": {

621
composer.lock
File diff suppressed because it is too large
View File

6
config/app.php

@ -177,7 +177,8 @@ return [
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
'Maatwebsite\Excel\ExcelServiceProvider', //Excel导入导出
SimpleSoftwareIO\QrCode\QrCodeServiceProvider::class, //Simple QrCode By FLi
'Maatwebsite\Excel\ExcelServiceProvider', //Excel导入导出 By FLi
],
/*
@ -226,7 +227,8 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Image' => Intervention\Image\Facades\Image::class, //图片处理
'Excel' => Maatwebsite\Excel\Facades\Excel::class, //Excel导入导出
'Excel' => Maatwebsite\Excel\Facades\Excel::class, //Excel导入导出 By FLi
'QrCode' => SimpleSoftwareIO\QrCode\Facades\QrCode::class, //Simple QrCode By FLi
],
];

25
routes/web.php

@ -187,10 +187,24 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
//接口路由,需token验证
Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web','token']], function () {
//用户中心
Route::post('/user_signin', 'UserController@signin');
Route::get('/user_info', 'UserController@userInfo');
Route::get('/user_list', 'UserController@userList');
Route::get('/user_money_list', 'UserMoneyController@userMoneyList'); //余额明细
Route::post('/user_money_add', 'UserMoneyController@userMoneyAdd'); //添加余额明细
//浏览记录
//商品
Route::get('/goods_list', 'GoodsController@goodsList'); //商品列表
Route::get('/goodstype_list', 'GoodsTypeController@goodsTypeList'); //商品分类列表
//商品评价
Route::get('/goods_comment_list', 'CommentController@goodsCommentList'); //商品评价列表
Route::post('/goods_comment_add', 'CommentController@goodsCommentAdd'); //商品评价添加
Route::post('/goods_comment_update', 'CommentController@goodsCommentUpdate'); //商品评价修改
Route::post('/goods_comment_delete', 'CommentController@goodsCommentDelete'); //商品评价删除
//商品收藏
Route::get('/collect_goods_list', 'CollectGoodsController@collectGoodsList'); //收藏商品列表
Route::post('/collect_goods_add', 'CollectGoodsController@collectGoodsAdd'); //收藏商品
Route::post('/collect_goods_delete', 'CollectGoodsController@collectGoodsDelete'); //取消收藏商品
//订单
//购物车
@ -198,17 +212,22 @@ Route::group(['prefix' => 'dataapi', 'namespace' => 'Api', 'middleware' => ['web
//分销
//积分
Route::get('/user_point_list', 'UserPointController@userPointList');
Route::post('/user_point_add', 'UserPointController@userPointAdd');
//优惠券
//微信
//意见反馈
Route::get('/feedback_list', 'FeedBackController@feedbackList');
Route::post('/feedback_add', 'FeedBackController@feedbackAdd');
//其它
Route::get('/verifycode_check', 'VerifyCodeController@check'); //验证码校验
Route::get('/andriod_upgrade', 'IndexController@andriodUpgrade'); //安卓升级
//图片上传
//二维码
Route::get('/create_simple_qrcode', 'QrcodeController@createSimpleQrcode');
//轮播图
Route::get('/slide_list', 'SlideController@slideList');
//收货地址

5
说明.txt

@ -34,8 +34,11 @@ php artisan key:generate
Simple QrCode文档:https://www.simplesoftware.io/docs/simple-qrcode/zh
$qrcode = new \SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
return $qrcode->size(500)->generate('Make a qrcode without Laravel!');
二进制数据直接显示成二维码图片return '<img src="data:image/png;base64,'.base64_encode(\QrCode::format('png')->encoding('UTF-8')->size(200)->generate('http://www.baidu.com/')).'">';

Loading…
Cancel
Save