Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
Opple-iOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
Opple-iOS
Commits
3894a2ff
Commit
3894a2ff
authored
Aug 30, 2016
by
曹云霄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加分享订单功能,待测试
parent
61cd6341
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
267 additions
and
95 deletions
+267
-95
CustomerOrderViewController.m
Lighting/Class/CustomerOrderViewController.m
+1
-1
LoginViewController.m
Lighting/Class/Login/LoginViewController.m
+1
-0
OrderdetailsViewController.m
Lighting/Class/OrderdetailsViewController.m
+26
-11
RebateDetailsViewController.m
Lighting/Class/RebateDetailsViewController.m
+1
-0
RebateViewController.m
Lighting/Class/RebateViewController.m
+5
-1
project.pbxproj
Lighting/Lighting.xcodeproj/project.pbxproj
+2
-1
StoryboardwithCYX.storyboard
Lighting/Lighting/StoryboardwithCYX.storyboard
+3
-3
HeaderforURL.h
Lighting/Tools/HeaderforURL.h
+6
-1
ShareGoodsViewController.h
Lighting/Tools/ShareGoodsViewController.h
+11
-0
ShareGoodsViewController.m
Lighting/Tools/ShareGoodsViewController.m
+102
-74
ShareGoodsViewController.xib
Lighting/Tools/ShareGoodsViewController.xib
+2
-3
autobuild.py
Lighting/autobuild.py
+107
-0
No files found.
Lighting/Class/CustomerOrderViewController.m
View file @
3894a2ff
...
...
@@ -200,7 +200,7 @@
{
UIStoryboard
*
storyboard
=
[
UIStoryboard
storyboardWithName
:
@"StoryboardwithCYX"
bundle
:
nil
];
OrderdetailsViewController
*
orderdetails
=
[
storyboard
instantiateViewControllerWithIdentifier
:
@"orderdetails"
];
TOOrderEntity
*
model
=
[[
self
.
datasArray
objectAtIndex_opple
:
indexPath
.
row
]
order
];
TOOrderEntity
*
model
=
(
TOOrderEntity
*
)
[[
self
.
datasArray
objectAtIndex_opple
:
indexPath
.
row
]
order
];
orderdetails
.
orderCode
=
model
.
orderNumber
;
orderdetails
.
sectionTitle
=
@[
@"订单信息"
,
@"客户信息"
,
@"收货信息"
,
@"商品信息"
,
@"附件信息"
];
orderdetails
.
isShowattachment
=
YES
;
...
...
Lighting/Class/Login/LoginViewController.m
View file @
3894a2ff
...
...
@@ -209,6 +209,7 @@
if
([
Name
isEqualToString
:
@"体验中心"
])
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"FollowHeartVC"
object
:
nil
];
return
;
}
else
if
([
Name
isEqualToString
:
@"场景库"
])
{
...
...
Lighting/Class/OrderdetailsViewController.m
View file @
3894a2ff
...
...
@@ -16,6 +16,7 @@
#import "AdditionalTableViewCell.h"
#import <QuickLook/QuickLook.h>
#import "PDFViewController.h"
#import "ShareGoodsViewController.h"
@interface
OrderdetailsViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
QLPreviewControllerDataSource
>
...
...
@@ -147,6 +148,18 @@
printButton
.
layer
.
cornerRadius
=
kCornerRadius
;
printButton
.
backgroundColor
=
kMainBlueColor
;
[
headerView
addSubview
:
printButton
];
//分享
UIButton
*
shareButton
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
shareButton
.
frame
=
CGRectMake
(
ScreenWidth
-
50
-
350
,
15
,
150
,
30
);
[
shareButton
setTitle
:
@"分享"
forState
:
UIControlStateNormal
];
[
shareButton
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateNormal
];
shareButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
12
];
[
shareButton
addTarget
:
self
action
:
@selector
(
ShareButtonClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
shareButton
.
layer
.
masksToBounds
=
YES
;
shareButton
.
layer
.
cornerRadius
=
kCornerRadius
;
shareButton
.
backgroundColor
=
kMainBlueColor
;
[
headerView
addSubview
:
shareButton
];
}
//横线
...
...
@@ -493,23 +506,25 @@
return
self
.
PDFpath
;
}
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
-
(
void
)
prepareForSegue
:
(
UIStoryboardSegue
*
)
segue
sender
:
(
id
)
sender
{
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
-
(
BOOL
)
prefersStatusBarHidden
{
return
YES
;
}
-
(
void
)
didReceiveMemoryWarning
{
[
super
didReceiveMemoryWarning
];
// Dispose of any resources that can be recreated.
#pragma mark - 分享订单
-
(
void
)
ShareButtonClick
:
(
UIButton
*
)
sender
{
ShareGoodsViewController
*
shareController
=
[[
ShareGoodsViewController
alloc
]
init
];
shareController
.
isShareOrderbill
=
YES
;
shareController
.
orderBillNumber
=
self
.
orderCode
;
shareController
.
preferredContentSize
=
CGSizeMake
(
290
,
120
);
shareController
.
modalPresentationStyle
=
UIModalPresentationPopover
;
UIPopoverPresentationController
*
popover
=
shareController
.
popoverPresentationController
;
popover
.
permittedArrowDirections
=
UIPopoverArrowDirectionUp
;
popover
.
barButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithCustomView
:
sender
];
[
self
presentViewController
:
shareController
animated
:
YES
completion
:
nil
];
}
@end
Lighting/Class/RebateDetailsViewController.m
View file @
3894a2ff
...
...
@@ -29,6 +29,7 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
inputRebateTextField
.
placeholder
=
[
NSString
stringWithFormat
:
@"当前可提现:%@"
,
self
.
rebateAmount
];
}
-
(
IBAction
)
rebateButtonClickAction
:
(
UIButton
*
)
sender
{
...
...
Lighting/Class/RebateViewController.m
View file @
3894a2ff
...
...
@@ -75,12 +75,16 @@
@implementation
RebateViewController
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
self
getRebateDatasFromUser
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
setupChildViewController
];
[
self
uiConfigAction
];
[
self
getRebateDatasFromUser
];
}
#pragma mark - UI
...
...
Lighting/Lighting.xcodeproj/project.pbxproj
View file @
3894a2ff
...
...
@@ -627,6 +627,7 @@
29834EC11CDF768C001A484F
/* XXuserController */
,
2962D06E1CD1A56B0058829D
/* RIghtVC */
,
2962D06A1CD1A3FE0058829D
/* MyClient */
,
29808A611CFEC287001D1020
/* Experiencecentre */
,
2928F83F1CD0AB830036D761
/* Shoppingcart */
,
2928F8251CD09BC10036D761
/* Tabbar */
,
0447085B1CD7C06B00555827
/* Login */
,
...
...
@@ -640,7 +641,6 @@
children
=
(
2916A7451D7039F600644C8C
/* Uiview+category */
,
29498C511D050DB3004FA79B
/* UIImagePickerController */
,
29808A611CFEC287001D1020
/* Experiencecentre */
,
29F14B931CF6A4B50005D3E5
/* Scanner */
,
2902E1301CF2907200268161
/* RefreshHeader */
,
294CF0E91CEDCF250055F1D8
/* PromptinformationView */
,
...
...
@@ -954,6 +954,7 @@
29808A651CFED6E5001D1020
/* Scene */
,
);
name
=
Experiencecentre
;
path
=
../Tools
;
sourceTree
=
"<group>"
;
};
29808A651CFED6E5001D1020
/* Scene */
=
{
...
...
Lighting/Lighting/StoryboardwithCYX.storyboard
View file @
3894a2ff
...
...
@@ -2788,10 +2788,10 @@
<rect
key=
"frame"
x=
"27"
y=
"16"
width=
"63"
height=
"21"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
weight=
"medium"
pointSize=
"15"
/>
<color
key=
"textColor"
cocoaTouchSystemColor=
"darkTextColor
"
/>
<color
key=
"textColor"
red=
"0.0"
green=
"0.0"
blue=
"0.0"
alpha=
"1"
colorSpace=
"calibratedRGB
"
/>
<nil
key=
"highlightedColor"
/>
</label>
<textField
opaque=
"NO"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
placeholder=
"当前可提现:1202"
textAlignment=
"natural"
minimumFontSize=
"17"
id=
"feT-lo-Gzz"
>
<textField
opaque=
"NO"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
textAlignment=
"natural"
minimumFontSize=
"17"
id=
"feT-lo-Gzz"
>
<rect
key=
"frame"
x=
"103"
y=
"11"
width=
"345"
height=
"30"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
...
...
@@ -2855,7 +2855,7 @@
<rect
key=
"frame"
x=
"288"
y=
"101"
width=
"192"
height=
"21"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMinX=
"YES"
flexibleMaxX=
"YES"
flexibleMaxY=
"YES"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"17"
/>
<color
key=
"textColor"
cocoaTouchSystemColor=
"darkTextColor
"
/>
<color
key=
"textColor"
red=
"0.0"
green=
"0.0"
blue=
"0.0"
alpha=
"1"
colorSpace=
"calibratedRGB
"
/>
<nil
key=
"highlightedColor"
/>
</label>
</subviews>
...
...
Lighting/Tools/HeaderforURL.h
View file @
3894a2ff
...
...
@@ -103,10 +103,15 @@
#define RESETORDER @"/order/updateOrderState/"
/**
* 分享
* 分享
商品
*/
#define SHARE @"/system/shareGoods"
/**
* 分享订单
*/
#define SHAREORDERBILL @"/order/OrderShare"
/**
* 产品筛选
*/
...
...
Lighting/Tools/ShareGoodsViewController.h
View file @
3894a2ff
...
...
@@ -57,5 +57,16 @@
*/
@property
(
nonatomic
,
assign
)
id
<
SharePicturedelegate
>
delegate
;
/**
* 分享订单、分享商品
*/
@property
(
nonatomic
,
assign
)
BOOL
isShareOrderbill
;
/**
* 订单ID
*/
@property
(
nonatomic
,
copy
)
NSString
*
orderBillNumber
;
@end
Lighting/Tools/ShareGoodsViewController.m
View file @
3894a2ff
...
...
@@ -26,98 +26,126 @@
#pragma mark -分享
-
(
IBAction
)
ShareWeiChatAntWeiboAction
:
(
UIButton
*
)
sender
{
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
NSData
*
imageData
=
UIImageJPEGRepresentation
(
self
.
shareImage
,
0
.
5
);
NSString
*
goodsID
=
[
self
.
goodsIds
substringToIndex
:[
self
.
goodsIds
length
]
-
1
];
NSDictionary
*
parameterDict
=
[
NSDictionary
dictionaryWithObjectsAndKeys
:[
goodsID
substringToIndex
:
self
.
goodsIds
.
length
-
1
],
@"goodsIds"
,
@""
,
@"title"
,
@""
,
@"remark"
,
nil
];
//上传图片
[[
NetworkRequestClassManager
Manager
]
UploadImageWithURL
:
SERVERREQUESTURL
(
SHARE
)
WithRequestType
:
0
WithImageDatas
:
imageData
WithParameter
:
parameterDict
WithReturnValueBlock
:^
(
id
returnValue
)
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
WS
(
weakSelf
);
if
(
self
.
isShareOrderbill
)
{
//分享订单
[
weakSelf
CreateMBProgressHUDLoding
];
NSString
*
shareOrderString
=
[
NSString
stringWithFormat
:
@"%@/%@"
,
SHAREORDERBILL
,
self
.
orderBillNumber
];
[[
NetworkRequestClassManager
Manager
]
NetworkWithDictionaryRequestWithURL
:
SERVERREQUESTURL
(
shareOrderString
)
WithRequestType
:
0
WithParameter
:
nil
WithReturnValueBlock
:^
(
id
returnValue
)
{
[
weakSelf
RemoveMBProgressHUDLoding
];
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
[
weakSelf
callSharePlatform
:
returnValue
[
@"data"
][
@"url"
]
withPlatformTag
:
sender
];
}
else
{
[
weakSelf
SHOWPrompttext
:
returnValue
[
@"message"
]];
}
NSString
*
shareWeb
=
returnValue
[
@"data"
][
@"url"
];
switch
(
sender
.
tag
)
{
case
100
:
//微信好友
{
//自定义样式
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
[
weakSelf
RemoveMBProgressHUDLoding
];
[
weakSelf
SHOWPrompttext
:
NETWORK
];
}
WithFailureBlock
:^
(
NSError
*
error
)
{
[
weakSelf
RemoveMBProgressHUDLoding
];
[
weakSelf
SHOWPrompttext
:
error
.
localizedDescription
];
}];
}
else
//分享商品
{
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
NSData
*
imageData
=
UIImageJPEGRepresentation
(
self
.
shareImage
,
0
.
5
);
NSString
*
goodsID
=
[
self
.
goodsIds
substringToIndex
:[
self
.
goodsIds
length
]
-
1
];
NSDictionary
*
parameterDict
=
[
NSDictionary
dictionaryWithObjectsAndKeys
:[
goodsID
substringToIndex
:
self
.
goodsIds
.
length
-
1
],
@"goodsIds"
,
@""
,
@"title"
,
@""
,
@"remark"
,
nil
];
//上传图片
[[
NetworkRequestClassManager
Manager
]
UploadImageWithURL
:
SERVERREQUESTURL
(
SHARE
)
WithRequestType
:
0
WithImageDatas
:
imageData
WithParameter
:
parameterDict
WithReturnValueBlock
:^
(
id
returnValue
)
{
if
([
returnValue
[
@"code"
]
isEqualToNumber
:
@0
])
{
NSString
*
shareWeb
=
returnValue
[
@"data"
][
@"url"
];
[
weakSelf
callSharePlatform
:
shareWeb
withPlatformTag
:
sender
];
}
else
{
if
([
weakSelf
.
delegate
respondsToSelector
:
@selector
(
CodeNotEqualZero
:)])
{
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[
UMSocialData
defaultData
].
extConfig
.
wechatSessionData
.
url
=
shareWeb
;
[[
UMSocialDataService
defaultDataService
]
postSNSWithTypes
:@[
UMShareToWechatSession
]
content
:
ShareTitle
image
:
self
.
shareImage
location
:
nil
urlResource
:
nil
presentedController
:
self
completion
:^
(
UMSocialResponseEntity
*
response
){
if
(
response
.
responseCode
==
UMSResponseCodeSuccess
)
{
[
self
SuccessMBProgressView
:
@"分享微信好友成功"
];
}
}];
[
weakSelf
.
delegate
CodeNotEqualZero
:
returnValue
[
@"message"
]];
}
}
}
WithprogressBlock
:^
(
double
progress
)
{
if
(
progress
>=
1
)
{
if
([
weakSelf
.
delegate
respondsToSelector
:
@selector
(
UploadImageSuccess
)])
{
break
;
case
101
:
//微信朋友圈
{
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[
UMSocialData
defaultData
].
extConfig
.
wechatTimelineData
.
url
=
shareWeb
;
[[
UMSocialDataService
defaultDataService
]
postSNSWithTypes
:@[
UMShareToWechatTimeline
]
content
:
ShareTitle
image
:
self
.
shareImage
location
:
nil
urlResource
:
nil
presentedController
:
self
completion
:^
(
UMSocialResponseEntity
*
response
){
if
(
response
.
responseCode
==
UMSResponseCodeSuccess
)
{
[
self
SuccessMBProgressView
:
@"分享微信朋友圈成功"
];
}
}];
[
weakSelf
.
delegate
UploadImageSuccess
];
}
break
;
case
102
:
//新浪微博
{
}
else
{
if
([
weakSelf
.
delegate
respondsToSelector
:
@selector
(
UploadImageProgress
:)])
{
//自定义分享样式
[
UMSocialData
defaultData
].
extConfig
.
sinaData
.
shareText
=
[
NSString
stringWithFormat
:
@"%@%@"
,
@"欧普照明"
,
shareWeb
];
[[
UMSocialDataService
defaultDataService
]
postSNSWithTypes
:@[
UMShareToSina
]
content
:
ShareTitle
image
:
self
.
shareImage
location
:
nil
urlResource
:
nil
presentedController
:
self
completion
:^
(
UMSocialResponseEntity
*
shareResponse
){
if
(
shareResponse
.
responseCode
==
UMSResponseCodeSuccess
)
{
[
self
SuccessMBProgressView
:
@"分享新浪微博成功"
];
}
}];
[
weakSelf
.
delegate
UploadImageProgress
:
progress
];
}
break
;
default
:
break
;
}
}
else
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
CodeNotEqualZero
:)])
{
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
NSError
*
error
)
{
if
([
weakSelf
.
delegate
respondsToSelector
:
@selector
(
UploadImageFailue
)])
{
[
self
.
delegate
CodeNotEqualZero
:
returnValue
[
@"message"
]
];
[
weakSelf
.
delegate
UploadImageFailue
];
}
}
}
WithprogressBlock
:^
(
double
progress
)
{
[
weakSelf
ErrorMBProgressView
:
error
.
localizedDescription
];
}];
}
}
if
(
progress
>=
1
)
{
#pragma mark - 调用分享
-
(
void
)
callSharePlatform
:
(
NSString
*
)
shareWeb
withPlatformTag
:
(
UIButton
*
)
sender
{
switch
(
sender
.
tag
)
{
case
100
:
//微信好友
{
//自定义样式
if
([
self
.
delegate
respondsToSelector
:
@selector
(
UploadImageSuccess
)])
{
[
self
.
delegate
UploadImageSuccess
];
}
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[
UMSocialData
defaultData
].
extConfig
.
wechatSessionData
.
url
=
shareWeb
;
[[
UMSocialDataService
defaultDataService
]
postSNSWithTypes
:@[
UMShareToWechatSession
]
content
:
ShareTitle
image
:
self
.
shareImage
location
:
nil
urlResource
:
nil
presentedController
:
self
completion
:^
(
UMSocialResponseEntity
*
response
){
if
(
response
.
responseCode
==
UMSResponseCodeSuccess
)
{
[
self
SuccessMBProgressView
:
@"分享微信好友成功"
];
}
}];
}
}
else
break
;
case
101
:
//微信朋友圈
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
UploadImageProgress
:)])
{
[
self
.
delegate
UploadImageProgress
:
progress
];
}
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[
UMSocialData
defaultData
].
extConfig
.
wechatTimelineData
.
url
=
shareWeb
;
[[
UMSocialDataService
defaultDataService
]
postSNSWithTypes
:@[
UMShareToWechatTimeline
]
content
:
ShareTitle
image
:
self
.
shareImage
location
:
nil
urlResource
:
nil
presentedController
:
self
completion
:^
(
UMSocialResponseEntity
*
response
){
if
(
response
.
responseCode
==
UMSResponseCodeSuccess
)
{
[
self
SuccessMBProgressView
:
@"分享微信朋友圈成功"
];
}
}];
}
}
WithErrorCodeBlock
:^
(
id
errorCodeValue
)
{
}
WithFailureBlock
:^
(
NSError
*
error
)
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
UploadImageFailue
)])
{
break
;
case
102
:
//新浪微博
{
[
self
.
delegate
UploadImageFailue
];
//自定义分享样式
[
UMSocialData
defaultData
].
extConfig
.
sinaData
.
shareText
=
[
NSString
stringWithFormat
:
@"%@%@"
,
@"欧普照明"
,
shareWeb
];
[[
UMSocialDataService
defaultDataService
]
postSNSWithTypes
:@[
UMShareToSina
]
content
:
ShareTitle
image
:
self
.
shareImage
location
:
nil
urlResource
:
nil
presentedController
:
self
completion
:^
(
UMSocialResponseEntity
*
shareResponse
){
if
(
shareResponse
.
responseCode
==
UMSResponseCodeSuccess
)
{
[
self
SuccessMBProgressView
:
@"分享新浪微博成功"
];
}
}];
}
[
self
ErrorMBProgressView
:
error
.
localizedDescription
];
}];
break
;
default
:
break
;
}
}
@end
Lighting/Tools/ShareGoodsViewController.xib
View file @
3894a2ff
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"
10117"
systemVersion=
"15F34
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
>
<document
type=
"com.apple.InterfaceBuilder3.CocoaTouch.XIB"
version=
"3.0"
toolsVersion=
"
9531"
systemVersion=
"15G31
"
targetRuntime=
"iOS.CocoaTouch"
propertyAccessControl=
"none"
useAutolayout=
"YES"
useTraitCollections=
"YES"
>
<dependencies>
<deployment
identifier=
"iOS"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"10085"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.IBCocoaTouchPlugin"
version=
"9529"
/>
</dependencies>
<objects>
<placeholder
placeholderIdentifier=
"IBFilesOwner"
id=
"-1"
userLabel=
"File's Owner"
customClass=
"ShareGoodsViewController"
>
...
...
Lighting/autobuild.py
0 → 100755
View file @
3894a2ff
from
optparse
import
OptionParser
import
subprocess
import
requests
#configuration for iOS build setting
CODE_SIGN_IDENTITY
=
"iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd"
PROVISIONING_PROFILE
=
"10361169-d429-4810-90f6-528335fe4062"
CONFIGURATION
=
"Release"
SDK
=
"iphoneos"
# configuration for pgyer
PGYER_UPLOAD_URL
=
"http://www.pgyer.com/apiv1/app/upload"
DOWNLOAD_BASE_URL
=
"http://www.pgyer.com"
USER_KEY
=
"a6283ec42bbaf9efc5b6f01a750299f3"
API_KEY
=
"f9aefb343ecc7959f8e216ed08db1c83"
def
cleanBuildDir
(
buildDir
):
cleanCmd
=
"rm -r
%
s"
%
(
buildDir
)
process
=
subprocess
.
Popen
(
cleanCmd
,
shell
=
True
)
process
.
wait
()
print
"cleaned buildDir:
%
s"
%
(
buildDir
)
def
parserUploadResult
(
jsonResult
):
resultCode
=
jsonResult
[
'code'
]
if
resultCode
==
0
:
downUrl
=
DOWNLOAD_BASE_URL
+
"/"
+
jsonResult
[
'data'
][
'appShortcutUrl'
]
print
"Upload Success"
print
"DownUrl is:"
+
downUrl
else
:
print
"Upload Fail!"
print
"Reason:"
+
jsonResult
[
'message'
]
def
uploadIpaToPgyer
(
ipaPath
):
print
"ipaPath:"
+
ipaPath
files
=
{
'file'
:
open
(
ipaPath
,
'rb'
)}
headers
=
{
'enctype'
:
'multipart/form-data'
}
payload
=
{
'uKey'
:
USER_KEY
,
'_api_key'
:
API_KEY
,
'publishRange'
:
'2'
,
'isPublishToPublic'
:
'2'
,
'password'
:
''
}
print
"uploading...."
r
=
requests
.
post
(
PGYER_UPLOAD_URL
,
data
=
payload
,
files
=
files
,
headers
=
headers
)
if
r
.
status_code
==
requests
.
codes
.
ok
:
result
=
r
.
json
()
parserUploadResult
(
result
)
else
:
print
'HTTPError,Code:'
+
r
.
status_code
def
buildProject
(
project
,
target
,
output
):
buildCmd
=
'xcodebuild -project
%
s -target
%
s -sdk
%
s -configuration
%
s build CODE_SIGN_IDENTITY="
%
s" PROVISIONING_PROFILE="
%
s"'
%
(
project
,
target
,
SDK
,
CONFIGURATION
,
CODE_SIGN_IDENTITY
,
PROVISIONING_PROFILE
)
process
=
subprocess
.
Popen
(
buildCmd
,
shell
=
True
)
process
.
wait
()
signApp
=
"./build/
%
s-iphoneos/
%
s.app"
%
(
CONFIGURATION
,
target
)
signCmd
=
"xcrun -sdk
%
s -v PackageApplication
%
s -o
%
s"
%
(
SDK
,
signApp
,
output
)
process
=
subprocess
.
Popen
(
signCmd
,
shell
=
True
)
(
stdoutdata
,
stderrdata
)
=
process
.
communicate
()
uploadIpaToPgyer
(
output
)
cleanBuildDir
(
"./build"
)
def
buildWorkspace
(
workspace
,
scheme
,
output
):
process
=
subprocess
.
Popen
(
"pwd"
,
stdout
=
subprocess
.
PIPE
)
(
stdoutdata
,
stderrdata
)
=
process
.
communicate
()
buildDir
=
stdoutdata
.
strip
()
+
'/build'
print
"buildDir: "
+
buildDir
buildCmd
=
'xcodebuild -workspace
%
s -scheme
%
s -sdk
%
s -configuration
%
s build CODE_SIGN_IDENTITY="
%
s" PROVISIONING_PROFILE="
%
s" SYMROOT=
%
s'
%
(
workspace
,
scheme
,
SDK
,
CONFIGURATION
,
CODE_SIGN_IDENTITY
,
PROVISIONING_PROFILE
,
buildDir
)
process
=
subprocess
.
Popen
(
buildCmd
,
shell
=
True
)
process
.
wait
()
signApp
=
"./build/
%
s-iphoneos/
%
s.app"
%
(
CONFIGURATION
,
scheme
)
signCmd
=
"xcrun -sdk
%
s -v PackageApplication
%
s -o
%
s"
%
(
SDK
,
signApp
,
output
)
process
=
subprocess
.
Popen
(
signCmd
,
shell
=
True
)
(
stdoutdata
,
stderrdata
)
=
process
.
communicate
()
uploadIpaToPgyer
(
output
)
cleanBuildDir
(
buildDir
)
def
xcbuild
(
options
):
project
=
options
.
project
workspace
=
options
.
workspace
target
=
options
.
target
scheme
=
options
.
scheme
output
=
options
.
output
if
project
is
None
and
workspace
is
None
:
pass
elif
project
is
not
None
:
buildProject
(
project
,
target
,
output
)
elif
workspace
is
not
None
:
buildWorkspace
(
workspace
,
scheme
,
output
)
def
main
():
parser
=
OptionParser
()
parser
.
add_option
(
"-w"
,
"--workspace"
,
help
=
"Build the workspace name.xcworkspace."
,
metavar
=
"name.xcworkspace"
)
parser
.
add_option
(
"-p"
,
"--project"
,
help
=
"Build the project name.xcodeproj."
,
metavar
=
"name.xcodeproj"
)
parser
.
add_option
(
"-s"
,
"--scheme"
,
help
=
"Build the scheme specified by schemename. Required if building a workspace."
,
metavar
=
"schemename"
)
parser
.
add_option
(
"-t"
,
"--target"
,
help
=
"Build the target specified by targetname. Required if building a project."
,
metavar
=
"targetname"
)
parser
.
add_option
(
"-o"
,
"--output"
,
help
=
"specify output filename"
,
metavar
=
"output_filename"
)
(
options
,
args
)
=
parser
.
parse_args
()
print
"options:
%
s, args:
%
s"
%
(
options
,
args
)
xcbuild
(
options
)
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment