Example #1
0
     //返回代号,未登录:114,
     $arry["msg"] = "请登录后再从行操作";
     //返回信息
 } else {
     //已登录
     function GetTJRowUS($zd, $table, $where)
     {
         $sql = "select {$zd} from {$table} where {$where}";
         $result = mysql_query($sql);
         while ($row = mysql_fetch_assoc($result)) {
             $TJRow[] = $row[$zd];
         }
         return $TJRow;
     }
     if (GetCount('shiyong', "id={$aid} and create_user_id={$usidse} and xianshi>2 and xianshi<>5")) {
         $usidarr = GetTJRowUS('userid', 'user_shiyong', "status in (-3,4,5) and shiyongid={$aid}");
         $Hegenum = GetCount('user_shiyong', "shiyongid={$aid} and status=6 and name='" . $usname . "'");
         if (empty($usidarr)) {
             $sql = "select * from  shiyong where id={$aid}";
             $result = mysql_query($sql);
             $usrow = mysql_fetch_assoc($result);
             if ($usrow['shiyongtype'] == 2) {
                 $cymoney = ($usrow['coupon_price'] + $usrow['hongbao']) * $usrow['num'] + $usrow['pt_meney'] * $usrow['num'] - $Hegenum * ($usrow['pt_meney'] + $usrow['coupon_price'] + $usrow['hongbao'] - $usrow['hs_price']);
             } else {
                 $cymoney = ($usrow['coupon_price'] + $usrow['hongbao']) * $usrow['num'] + $usrow['pt_meney'] * $usrow['num'] - $Hegenum * ($usrow['pt_meney'] + $usrow['coupon_price'] + $usrow['hongbao']);
             }
             $mingxiC = "您发布编号ID为:" . $usrow['id'] . "的活动结算完成," . $Hegenum . "用户参与,解冻" . $cymoney . "元";
             $countjs = Kmoney($usname, $cymoney, $mingxiC, 'balance', 1, 1, 0);
             if (Zbkupdate('shiyong', array('xianshi' => 5, 'lasttime' => $CCtimes), "create_user_id={$usidse} and id={$aid}")) {
                 $arry['id'] = 219;
                 //终止成功
Example #2
0
     $sql = "select {$zd} from {$table} where {$where}";
     $result = mysql_query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         $TJRow[] = $row[$zd];
     }
     return $TJRow;
 }
 if (GetCount('duihuan', "id={$aid} and create_user_id={$usidse} and xianshi>2 and xianshi<>5")) {
     $usidarrid = GetTJRowUS('cj_id', 'user_duihuan', "status in (1,4) and cj_gid={$aid}");
     if (!empty($usidarrid)) {
         foreach ($usidarrid as $cjusid) {
             Autochoujiang('step1_time', 7, 1, $cjusid, -2, 'user_duihuan');
             Autochoujiang('step4_time', 10, 4, $cjusid, 5, 'user_duihuan');
         }
     }
     $usidarr = GetTJRowUS('cj_id', 'user_duihuan', "status in (1,3,4,-4,-5) and cj_gid={$aid}");
     if (empty($usidarr)) {
         $sql = "select * from  duihuan where id={$aid}";
         $result = mysql_query($sql);
         $usrow = mysql_fetch_assoc($result);
         $cymoney = $usrow['coupon_price'] * $usrow['num'];
         $mingxiC = "您发布编号ID为:" . $usrow['id'] . "的兑换活动圆满结束,结算完成," . $cymoney . "元全部解冻";
         if (Zbkupdate('duihuan', array('xianshi' => 5, 'lasttime' => $CCtimes), "create_user_id={$usidse} and id={$aid}")) {
             $countjs = Kmoney($usname, $cymoney, $mingxiC, 'balance', 1, 1, 0);
             $arry['id'] = 219;
             //终止成功
             $arry['msg'] = "结算成功,活动圆满成功";
         } else {
             $arry['id'] = 0;
             //终止失败
             $arry['msg'] = "失败";
 $aid = isset($_GET["aid"]) ? $_GET["aid"] : 0;
 $state = isset($_GET["state"]) ? $_GET["state"] : 0;
 $searchkey = isset($_GET["searchkey"]) ? $_GET["searchkey"] : "";
 $searchtype = isset($_GET["searchtype"]) ? $_GET["searchtype"] : 0;
 $days = isset($_GET["days"]) ? $_GET["days"] : 0;
 $zjtype = isset($_GET["zjtype"]) ? $_GET["zjtype"] : 0;
 function GetTJRowUS($zd, $table, $where)
 {
     $sql = "select {$zd} from {$table} where {$where}";
     $result = mysql_query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         $TJRow[] = $row[$zd];
     }
     return $TJRow;
 }
 $usidarrid = GetTJRowUS('cj_id', 'choujiang', "status in (1,4) and name='{$usname}' and (step1_time+604800<{$CCtimes} or step4_time+864000<{$CCtimes})");
 if (!empty($usidarrid)) {
     foreach ($usidarrid as $cjusid) {
         Autochoujiang('step1_time', 7, 1, $cjusid, -2, 'choujiang');
         Autochoujiang('step4_time', 10, 4, $cjusid, 5, 'choujiang');
     }
 }
 $where = '';
 if ($state == 0) {
     $where = 'and 1=1';
 } else {
     $where = $where . " and a.status={$state}";
 }
 if ($aid != 0) {
     $where = $where . " and a.cj_gid={$aid}";
 }
     $sql = "select {$zd} from {$table} where {$where}";
     $result = mysql_query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         $TJRow[] = $row[$zd];
     }
     return $TJRow;
 }
 if (GetCount('gift', "id={$aid} and create_user_id={$usidse} and xianshi>2 and xianshi<>5")) {
     $usidarrid = GetTJRowUS('cj_id', 'choujiang', "status in (1,4) and cj_gid={$aid}");
     if (!empty($usidarrid)) {
         foreach ($usidarrid as $cjusid) {
             Autochoujiang('step1_time', 7, 1, $cjusid, -2, 'choujiang');
             Autochoujiang('step4_time', 10, 4, $cjusid, 5, 'choujiang');
         }
     }
     $usidarr = GetTJRowUS('cj_id', 'choujiang', "status in (1,3,4,-4,-5) and cj_gid={$aid}");
     if (empty($usidarr)) {
         $sql = "select * from  gift where id={$aid}";
         $result = mysql_query($sql);
         $usrow = mysql_fetch_assoc($result);
         $cymoney = $usrow['coupon_price'] * $usrow['num'];
         $mingxiC = "您发布编号ID为:" . $usrow['id'] . "的抽奖活动圆满结束,结算完成," . $cymoney . "元全部解冻";
         if (Zbkupdate('gift', array('xianshi' => 5, 'lasttime' => $CCtimes), "create_user_id={$usidse} and id={$aid}")) {
             $countjs = Kmoney($usname, $cymoney, $mingxiC, 'balance', 1, 1, 0);
             $arry['id'] = 219;
             //终止成功
             $arry['msg'] = "结算成功,活动圆满成功";
         } else {
             $arry['id'] = 0;
             //终止失败
             $arry['msg'] = "失败";