예제 #1
0
 public function tmodel()
 {
     $m = new WXMessageModel();
     if ($m->createItem(String::keyGen(), 'touserName', 'fromuserName', 'text', 'sdf', 'sdfasd', 1, 2, '21', 11)) {
         $m->setField(WXMessageModel::UserID, "xxxxxxxxxxxx");
         $m->add();
         // 写入数据
     }
 }
예제 #2
0
파일: function.php 프로젝트: Jitlee/YYG
function saveImage($folder, $content)
{
    $tmpId = \Org\Util\String::keyGen();
    $fileName = '/Uploads/' . $folder . '/' . array('date', 'Ymd') . '/' . $tmpId . '.jpg';
    list($type, $data) = explode(';', $content);
    list(, $data) = explode(',', $content);
    file_put_contents($fileName, base64_decode($content));
    return;
}
예제 #3
0
 /**
  * 创建预支付订单
  */
 public function createPrePay()
 {
     if (is_login()) {
         $adb = M('account');
         $cdb = D('cart');
         $agdb = M('AccountGoods');
         $result['status'] = -1;
         $adb->startTrans();
         $uid = get_temp_uid();
         $payid = \Org\Util\String::keyGen();
         $accountData = array('payid' => $payid, 'uid' => $uid, 'type' => -1, 'status' => 0);
         if ($adb->add($accountData) !== FALSE) {
             $map['uid'] = $uid;
             $list = $cdb->where($map)->select();
             $result['status'] = 0;
             // 复制购物车
             foreach ($list as $cart) {
                 $cart['payid'] = $payid;
                 if ($agdb->add($cart) === FALSE) {
                     $result['status'] = -1;
                     break;
                 }
             }
             // 清空购物车
             if ($result['status'] == 0 && $cdb->where($map)->delete() === FALSE) {
                 $result['status'] = -1;
                 // 失败
                 $result['message'] = $cdb->getLastSql();
             }
         }
         if ($result['status'] == 0) {
             $adb->commit();
             $result['rst'] = $payid;
             empty_cart();
         } else {
             $adb->rollback();
         }
     } else {
         // 未登录
         $result['status'] = -2;
     }
     $this->ajaxReturn($result, 'JSON');
 }
예제 #4
0
 public function keyGen()
 {
     return String::keyGen();
 }