php人人商城定时任务,人人商城异步操作菜单示例

本文最后更新于2019-09-30,已超过 1年没有更新,如果文章内容、图片或者下载资源失效,请留言反馈,我会及时处理,谢谢!

温馨提示:本文共2963个字,读完预计8分钟。

菜单:

{$item['displayorder']}

服务端方法

public function change()

{

global $_W;

global $_GPC;

$id = intval($_GPC[‘id’]);

if (empty($id)) {

show_json(0, array('message' => '参数错误'));

}

else {

pdo_update('ewei_shop_goods', array('newgoods' => 0), array('id' => $id));

}

$type = trim($_GPC[‘type’]);

$value = trim($_GPC[‘value’]);

if (!in_array($type, array('title', 'marketprice', 'total', 'goodssn', 'productsn', 'displayorder', 'dowpayment'))) {

show_json(0, array('message' => '参数错误'));

}

$goods = pdo_fetch('select id,hasoption,marketprice,dowpayment,`type`,isdiscount,isdiscount_time from ' . tablename('ewei_shop_goods') . ' where id=:id and uniacid=:uniacid limit 1', array(':uniacid' => $_W[‘uniacid’], ':id' => $id));

if (empty($goods)) {

show_json(0, array('message' => '参数错误'));

}

if ($type == 'dowpayment') {

if ($goods[‘marketprice’] < $value) {

show_json(0, array('message' => '定金不能大于总价'));

}

}

else {

if ($type == 'marketprice') {

if ($value < $goods[‘dowpayment’]) {

show_json(0, array('message' => '总价不能小于定金'));

}

}

}

if ($type == 'total' && $goods[‘type’] == 3) {

show_json(0, array('message' => '虚拟卡密产品不可直接修改库存'));

}

$result = pdo_update('ewei_shop_goods', array($type => $value), array('id' => $id));

if ($type == 'total' && $result) {

plog('goods.list', '编辑商品 ID: ' . $id . '
库存量为' . $value);

}

if ($goods[‘hasoption’] == 0 && !in_array($type, array('displayorder', 'total'))) {

if ($goods[‘isdiscount’] == 0 || $goods[‘isdiscount_time’] < time()) {

$sql = 'update ' . tablename('ewei_shop_goods') . (' set minprice = marketprice,maxprice = marketprice where id = ' . $goods[‘id’] . ' and hasoption=0;');

pdo_query($sql);

}

else {

$sqlgoods = 'SELECT id,title,thumb,marketprice,productprice,minprice,maxprice,isdiscount,isdiscount_time,isdiscount_discounts,sales,total,description,merchsale FROM ' . tablename('ewei_shop_goods') . ' where id=:id and uniacid=:uniacid limit 1';

$goodsinfo = pdo_fetch($sqlgoods, array(':id' => $id, ':uniacid' => $_W[‘uniacid’]));

$goodsinfo = m('goods')->getOneMinPrice($goodsinfo);

pdo_update('ewei_shop_goods', array('minprice' => $goodsinfo[‘minprice’], ‘maxprice’ => $goodsinfo[‘maxprice’]), array(‘id’ => $id, ‘uniacid’ => $_W[‘uniacid’]));

}

}

show_json(1);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值