1.创建文件 includes/modules/auto_order_confirm.php
代码:(思路:对已经发货和已经付款的订单检索,对比发货时间与当前时间的间隔,达到设定时间则自动收货)
'auto_order_days', 'type' => 'select', 'value' => 7) ); //name:计划任务的名称,type:类型(text,textarea,select…),value:默认值 return;}$now_time=gmtime();$days = !empty($cron['auto_order_days']) ? $cron['auto_order_days'] : 7;$select_sql = 'SELECT order_id, shipping_time,shipping_status FROM '.$ecs->table('order_info').' where shipping_status=1 and pay_status=2 ';$order_val=$db->getAll($select_sql);if (empty($order_val)) { return false;}foreach ($order_val as $key => $value) { if ($now_time-$value['shipping_time']>=$days*24*3600) { $order = order_info($value['order_id']); /* 标记订单为“收货确认”,如果是货到付款,同时修改订单为已付款 */ $arr = array('shipping_status' => SS_RECEIVED); $payment = payment_info($order['pay_id']); if ($payment['is_cod']) { $arr['pay_status'] = PS_PAYED; $order['pay_status'] = PS_PAYED; } update_order($value['order_id'], $arr); /* 记录log */ order_action($order['order_sn'], $order['order_status'], SS_RECEIVED, $order['pay_status'], $_LANG['action_note']); }}?>
2.创建文件:languages/zh_cn/cron/auto_order_condirm.php
代码:(文字描述以及时间设定)
3.如果需要,将另外两种语言的设置下即可(翻译第二个文件)。