Commit 035f6571 authored by 龚双喜's avatar 龚双喜

Merge branch 'staff/gongshuangxi' into dev

parents 4207ff6d 0da9431f
...@@ -10,13 +10,15 @@ use app\common\library\Sms as Smslib; ...@@ -10,13 +10,15 @@ use app\common\library\Sms as Smslib;
use app\admin\model\shopro\user\User as UserModel; use app\admin\model\shopro\user\User as UserModel;
use addons\shopro\facade\Wechat; use addons\shopro\facade\Wechat;
use app\common\model\shopro\Ad; use app\common\model\shopro\Ad;
use think\Db;
use think\Hook; use think\Hook;
use think\Log;
class Index extends Common class Index extends Common
{ {
use Util; use Util;
protected $noNeedLogin = ['init', 'pageSync', 'page', 'feedback', 'send', 'test', 'ad']; protected $noNeedLogin = ['init', 'pageSync', 'page', 'feedback', 'send', 'test', 'ad', 'monthlyNewGoods'];
protected $noNeedRight = ['*']; protected $noNeedRight = ['*'];
public function init() public function init()
...@@ -200,6 +202,28 @@ class Index extends Common ...@@ -200,6 +202,28 @@ class Index extends Common
/** /**
* 获取每月最新商品
* 每月取最新上架的商品,没有返回空
*/
public function monthlyNewGoods()
{
$limit = $this->request->param('limit', 10);
$month = $this->request->param('month', date('Y-m'));
$goods = \app\admin\model\shopro\goods\Goods::where('status', 'up')
->field('id,title,image,original_price,price')
->whereTime('createtime', 'between', ["{$month}-01", "{$month}-31"])
->order('createtime', 'desc')
->limit($limit)
->select();
if (!$goods) {
$this->success('获取成功', []);
}
$this->success('获取成功', $goods);
}
/**
* 获取统一验证 token * 获取统一验证 token
* *
* @return void * @return void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment