Example #1
0
 public static function changehongbao($task_id, $moneys, $uid, $money, $title, $g)
 {
     $result = db_factory::get_one('select * from ' . TABLEPRE . 'witkey_space where uid=' . $uid);
     if ($g) {
         $newbalance = $result['balance'] - $money + $moneys;
         db_factory::query('update ' . TABLEPRE . 'witkey_space set balance=' . $newbalance . ' where uid=' . $uid);
         keke_finance_class::insert_trust("in", "task_xg", $uid, -$money + $moneys, $newbalance);
     } else {
         $newbalance = $result['balance'] + $money;
         keke_finance_class::insert_trust("in", "finish_task", $uid, $money, $newbalance, $task_id);
         db_factory::query('update ' . TABLEPRE . 'witkey_space set balance=' . $newbalance . ' where uid=' . $uid);
         db_factory::query('update ' . TABLEPRE . 'witkey_space set is_hongbao=1 where uid=' . $uid);
         db_factory::query('update ' . TABLEPRE . 'witkey_task_work set work_status=4 where uid=' . $uid . ' and task_id=' . $task_id);
     }
     if (!$g) {
         $v_arr = array("红包任务" => '【' . $title . '】', "红包金额" => $money);
         keke_msg_class::notify_user($uid, $result['username'], 'select', '红包任务完成通知', $v_arr);
     }
     return true;
 }