Exemplo n.º 1
0
	static function Assign($order) {
		$ccon = array('order_id' => $order['id']);
		$count = Table::Count('voucher', $ccon);
		//send_goods_confirm_by_platform
		if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) {
			alipay_send_goods($order['trade_no']);		
		}
		while($count<$order['quantity']) {
			$voucher = self::GetValidVoucher($order['team_id']);
			if (!$voucher) break;
			$flag =	Table::UpdateCache('voucher', $voucher['id'], array(
						'user_id' => $order['user_id'],
						'order_id' => $order['id'],
						));
			if($flag){
				$voucher = Table::Fetch('voucher', $voucher['id']);
				global $INI;
				if ($INI['sms']['auto']=='1')
					sms_voucher($voucher);
			}
			$count = Table::Count('voucher', $ccon);
		}
	}
Exemplo n.º 2
0
         json(array(array('data' => "{$action}{$money}元成功", 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix');
     }
     json('充值失败', 'alert');
 } else {
     if ('orderexpress' == $action) {
         need_auth('order');
         $express_id = abs(intval($_GET['eid']));
         $express_no = strval($_GET['nid']);
         if (!$express_id) {
             $express_no = null;
         }
         Table::UpdateCache('order', $id, array('express_id' => $express_id, 'express_no' => $express_no));
         $order = Table::Fetch('order', $id);
         if ($order['service'] == 'alipay' && ($INI['alipay']['autosendgoods'] = 'Y') && $INI['alipay']['guarantee'] != 'Y') {
             $express = Table::Fetch('category', $express_id);
             alipay_send_goods($order['trade_no'], $express['name'], $express_no);
         }
         json(array(array('data' => "修改快递信息成功", 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix');
     } else {
         if ('orderview' == $action) {
             need_rbac_auth('order_detail_box', true);
             $order = Table::Fetch('order', $id);
             $user = Table::Fetch('user', $order['user_id']);
             $team = Table::Fetch('team', $order['team_id']);
             //find coupons
             $coupons = DB::LimitQuery('coupon', array('condition' => array('order_id' => $order['id'], 'user_id' => $user['id'])));
             $order['referer'] = Table::Fetch('referer', $id, 'order_id');
             if ($team['delivery'] == 'express') {
                 $option_express = option_category('express');
                 $order['express_name'] = $option_express[$order['express_id']];
             }