Пример #1
0
    $location = pdo_fetch('SELECT status,location_id FROM ' . tablename('coupon_location') . ' WHERE uniacid = :aid AND id = :id', array(':aid' => $_W['uniacid'], ':id' => $id));
    if (!empty($location['location_id'])) {
        load()->classs('coupon');
        $acc = new coupon($acid);
        $status = $acc->LocationDel($location['location_id']);
        if (is_error($status)) {
            message($status['message'], '', 'error');
        }
    }
    pdo_delete('coupon_location', array('uniacid' => $_W['uniacid'], 'acid' => $acid, 'id' => $id));
    message('删除门店成功', url('wechat/manage/location_list'), 'success');
}
if ($do == 'export') {
    load()->classs('coupon');
    $acc = new coupon($acid);
    $location = $acc->LocationBatchGet();
    if (is_error($location)) {
        message($location['message'], referer(), 'error');
    }
    $location = $location['business_list'];
    $status2local = array('', 3, 2, 1, 3);
    if (!empty($location)) {
        foreach ($location as $li) {
            $li = $li['base_info'];
            if ($li['available_state'] == 3 && !empty($li['poi_id']) && empty($li['sid'])) {
                $isexist = pdo_fetchcolumn('SELECT id FROM ' . tablename('coupon_location') . ' WHERE uniacid = :uniacid AND acid = :acid AND location_id = :location_id', array(':uniacid' => $_W['uniacid'], ':acid' => $acid, ':location_id' => $li['poi_id']));
                if (empty($isexist)) {
                    $li['uniacid'] = $_W['uniacid'];
                    $li['acid'] = $acid;
                    $li['status'] = 1;
                    $li['location_id'] = $li['poi_id'];